[Info-vax] Suggestion: Enhance DCL to support proper escape quoting.

hb end.of at inter.net
Thu Jan 20 05:59:59 EST 2022


On 1/20/22 10:35, Jan-Erik Söderholm wrote:
> Den 2022-01-20 kl. 09:28, skrev Phillip Helbig (undress to reply):
...
>> Consider the TeX command \".  OK, to search for it I need to escape the
>> backslash, thus search for \\".  But then " is part of what I'm
>> searching for, so using that as a delimiter is also tricky.
> 
> If " is escapable, it would be '$ grep "\\\"" helloworld.tex'.
> 
> Or if that line is processed by DCL, maybe '$ grep "\\""" helloworld.tex'.
> The usual double double-quote to get one double-quote.
> 
> 
>> The DCL
>> solution has the advantage that it is pretty obvious what it does.
>>
>> Note that \\ is also a valid TeX command (which means "start a new line
>> here".  So to search for that I would search for \\\\?
>>
> 
> Yes, two (2) escaped backslashes looks fine.

Real code, real examples?

On VMS, from DCL
$ ty morehellos.tex
\documentclass[12pt]{article}
\begin{document}
Hello w\"orld!
Hello\\world!
"Hello world!"
\end{document}
$
$ grep "\\""" morehellos.tex
Hello w\"orld!
$
$ grep "\\\\" morehellos.tex
Hello\\world!
$
$ grep """" morehellos.tex
Hello w\"orld!
"Hello world!"
$

 From a bash you would probably use a single quote as a string 
delimiter. Which means you do not need to escape anything for bash 
within the string except the string delimiter, which is not searched, 
here. Anything in the string is a regular expression. That itself 
requires escaping its escape character - same as from DCL.

$ grep '\\"' morehellos.tex
Hello w\"orld!
$
$ grep '\\\\' morehellos.tex
Hello\\world!
$
$ grep '"' morehellos.tex
Hello w\"orld!
"Hello world!"
$

 From bash, if you really want to use double quotes as a string 
delimiter, you need to escape the bash special characters, as they are 
interpreted in that string.

$ grep "\\\\\"" morehellos.tex
Hello w\"orld!
$
$ grep "\\\\\\\\" morehellos.tex
Hello\\world!
$
grep "\"" morehellos.tex
Hello w\"orld!
"Hello world!"
$



More information about the Info-vax mailing list