[Info-vax] SEARCH ''
Stephen Hoffman
seaohveh at hoffmanlabs.invalid
Tue Jan 18 19:13:19 EST 2022
On 2022-01-18 17:26:06 +0000, hb said:
> On 1/18/22 16:52, Stephen Hoffman wrote:
>> $ search x.com "'" + "'"
>
> SEARCH (or DCL - which seems more likely) uses "+" as a list separator,
> so the above command is the same as
> search x.com "'" , "'"
> That is, it finds single quotes.
Yeah, I see that now.
I'd forgotten how limited DCL was.
Ah, well.
$ pipe x="'" + "'" | search x.com &x
$ write sys$output "Page size: ''ps'"
>
>> grep or find or other tools will work here too, when those are
>> installed and available.
>>
>> DCL doesn't have an equivalent to the backslash
>> escape-the-next-character syntax present in some other contexts.
>>
>
> Using grep on *nix for this search is straight forward: grep "''" x.com
> On VMS it's not that obvious: grep "[']\{2\}" x.com
> but there may be an easier way to do that, which I missed.
Works the same.
$ run gnv$gnu:[bin]bash
bash$ grep "''" x.com
$ write sys$output "Page size: ''ps'"
bash$
That avoids using DCL input processing, which avoids the DCL symbol
substitution.
Can't say I find DCL particularly competitive for text-processing
tasks, though it is available in the default install.
One of the arguable advantages of DCL over most shells is the
default-fail error handling. Most shells have to request that. And set
-e is its own fine mess in bash. Though trap is ~close to ON, and a bit
more flexible.
--
Pure Personal Opinion | HoffmanLabs LLC
More information about the Info-vax
mailing list