Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SEARCH ''

254 views
Skip to first unread message

Phillip Helbig (undress to reply)

unread,
Jan 17, 2022, 3:52:13 PM1/17/22
to
I had occasion to SEARCH for the string '' in a file.

Is there any way to do this? (It gets expanded as an empty symbol; I
don't know how to prevent that.)

Related question: SEARCH/STAT gives me the record count, not the number
of times the string appears in the file, so they are not the same if it
occurs more than once on one line. Is there any way to get that
information from SEARCH? (A workaround is to replace the string with
itself in EDT and look at the count displayed.)

Steven Schweda

unread,
Jan 17, 2022, 4:55:44 PM1/17/22
to
> I had occasion to SEARCH for the string '' in a file.
>
> Is there any way to do this? (It gets expanded as an empty symbol; I
> don't know how to prevent that.)

I know of none. Zip would like to quote or escape all special
characters when it creates a command line to use with system() (for its
"-T[T]" option, to run UnZip to test an archive), but I couldn't see a
way to do this. Hence this comment in zip.c:quote_arg():

* On VMS, quoted double apostrophes are also special. Currently not
* handled. (How? Quotation marks are needed for (upper-)case
* preservation. Double apostrophes in quotation marks are interpreted
* (symbol evaluation). SMS sees no way to handle "fr''ed". "fr'""'ed"
* becomes >fr'"'ed<, for example.) Not a problem for file specs, but
* imposes a restriction on passwords.

If there _is_ a way, then please let me know.

(Building an argv[], and not using system(), would be one way in the
Zip case, but a general DCL method would be nice to have.)

Hein RMS van den Heuvel

unread,
Jan 17, 2022, 5:20:36 PM1/17/22
to
Well my friend. You appear to have missed the DCL 101 class.
To provide a double quote, double double up!

$ cre tmp.tmp
qwfqwe
werfqwerf
qwerf"erfwerf
werfqwerf
Exit
$ search tmp.tmp """" ! 3 or 4 double quotes, as the final double quote is option (DCL 102)
qwerf"erfwerf

Hein RMS van den Heuvel

unread,
Jan 17, 2022, 5:27:50 PM1/17/22
to
On Monday, January 17, 2022 at 5:20:36 PM UTC-5, Hein RMS van den Heuvel wrote:
> On Monday, January 17, 2022 at 3:52:13 PM UTC-5, Phillip Helbig (undress to reply) wrote:
> > I had occasion to SEARCH for the string '' in a file.

> To provide a double quote, double double up!

Nevermind.... My reader suggested you were looking for a double-quote.
Once pasted in a terminal window i could see two single quotes. It would have been nice/smart to spell that out.
Steven saw it, I did not.

Hein

hb

unread,
Jan 17, 2022, 5:40:36 PM1/17/22
to
Maybe this helps:
$ cre x.txt
quote '
two quotes ''
Exit
$
$ one:="'"
$ two=one+one
$ search x.txt &two
two quotes ''
$

Phillip Helbig (undress to reply)

unread,
Jan 18, 2022, 12:27:10 AM1/18/22
to
In article <127d2859-d2fd-44ea...@googlegroups.com>,
No ambiguity when reading in a DECterm. :-)

Phillip Helbig (undress to reply)

unread,
Jan 18, 2022, 12:31:23 AM1/18/22
to
In article <ss4r90$1q7m$1...@gioia.aioe.org>, hb <end...@inter.net> writes:

> On 1/17/22 21:52, Phillip Helbig (undress to reply) wrote:
> > I had occasion to SEARCH for the string '' in a file.
> >
> > Is there any way to do this? (It gets expanded as an empty symbol; I
> > don't know how to prevent that.)

> Maybe this helps:
> $ cre x.txt
> quote '
> two quotes ''
> Exit
> $
> $ one:="'"
> $ two=one+one
> $ search x.txt &two
> two quotes ''
> $

Brilliant! Works great!

Stephen Hoffman

unread,
Jan 18, 2022, 10:52:28 AM1/18/22
to
On 2022-01-17 20:52:11 +0000, Phillip Helbig (undress to reply said:

> I had occasion to SEARCH for the string '' in a file.

$
$ type x.com
$ ps = f$getsyi("PAGE_SIZE")
$ write sys$output "Page size: ''ps'"
$ exit
$ @x.com
Page size: 8192
$ search x.com "'" + "'"
$ 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.




--
Pure Personal Opinion | HoffmanLabs LLC

hb

unread,
Jan 18, 2022, 12:26:10 PM1/18/22
to
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.

> 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.

David Jones

unread,
Jan 18, 2022, 4:05:44 PM1/18/22
to
On Monday, January 17, 2022 at 3:52:13 PM UTC-5, Phillip Helbig (undress to reply) wrote:
> I had occasion to SEARCH for the string '' in a file.
>
> Is there any way to do this? (It gets expanded as an empty symbol; I
> don't know how to prevent that.)
>

$ dsq = "'" + "'" ! make symbol containing 2 single quotes
$ search myfile.txt &dsq

Stephen Hoffman

unread,
Jan 18, 2022, 7:13:22 PM1/18/22
to
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.

hb

unread,
Jan 19, 2022, 5:20:06 AM1/19/22
to
On 1/19/22 01:13, Stephen Hoffman wrote:
FWIW,
> $ pipe x="'" + "'" | search x.com &x
does not work:
%DCL-W-UNDSYM, undefined symbol - check validity and spelling

You probably had a symbol x defined outside of the pipe command.

$ x:=exit
$ pipe x="'" + "'" | search x.com &x
$ exit

A working pipe command is:
$ pipe x="'" + "'" ; search x.com &x

And that sets/overwrites the symbol x, which can be avoided:
$ x:=exit
$ pipe ( x="'" + "'" ; search x.com &x )

Stephen Hoffman

unread,
Jan 19, 2022, 9:50:35 AM1/19/22
to
Ah, well. Phillip, you're on your own.

Phillip Helbig (undress to reply)

unread,
Jan 19, 2022, 10:31:56 AM1/19/22
to
In article <ss98fn$ahb$1...@dont-email.me>, Stephen Hoffman
<seao...@hoffmanlabs.invalid> writes:

> Ah, well. Phillip, you're on your own.

A couple of people had already posted the proper answer:

$ QUOTE = "'"
$ QUOTES = QUOTE + QUOTE
$ SEARCH <file> &QUOTES

Stephen Hoffman

unread,
Jan 19, 2022, 10:38:42 AM1/19/22
to
On 2022-01-19 15:31:52 +0000, Phillip Helbig (undress to reply said:

> In article <ss98fn$ahb$1...@dont-email.me>, Stephen Hoffman
> <seao...@hoffmanlabs.invalid> writes:
>
>> Ah, well. Phillip, you're on your own.
>
> A couple of people had already posted the proper answer:

That's what this does, but (mistakes aside) in one line.

But for some of us, the proper answer is probably closer to "don't use DCL".

DCL, FORTRAN, C, and some other common OpenVMS programming languages
just aren't very good at strings.

Bill Gunshannon

unread,
Jan 19, 2022, 11:01:28 AM1/19/22
to
This might have been sarcasm, but why would you think FORTRAN an C
"aren't very good at strings". Even FORTRAN IV could do strings
with only a little coaxing. :-)

bill

Jan-Erik Söderholm

unread,
Jan 19, 2022, 11:08:38 AM1/19/22
to
If you have a question about a spcific DCL syntax, why would
not a DCL example be the "proper answer".

Funny how it is someone else fault (or DCLs fault) when you
(once) happens to come up with a wrong answer.

Phillip Helbig (undress to reply)

unread,
Jan 19, 2022, 12:20:45 PM1/19/22
to
In article <ss9ba0$vb7$1...@dont-email.me>, Stephen Hoffman
<seao...@hoffmanlabs.invalid> writes:

> DCL, FORTRAN, C, and some other common OpenVMS programming languages
> just aren't very good at strings.

I used to write presentations by hand on transparencies. Then I did
them in LaTeX and printed them out on transparencies (for overhead
projectors). Then I displayed the PDF produced from LaTeX via a
projector. Then I added the functionality to build up a slide bullet
point by bullet point (by using the \include command in LaTeX; no
content is present more than once in the source code). I had seen other
people do that but had no idea how it was done (probably similar to how
I do it: multiple pages, and each page has one more point than the
previous one). Then I added the full pages after the transparencies.
That makes it easy to "go back to slide 5"; I've seen so many people
paging through their entire presentation line by line. My guess is that
PowerPoint or whatever could do that as well, but strangely I've rarely
if ever seen it.

Then---drumroll, please---I moved from writing the LaTeX by hand (from
templates, of course), with all the \include commands, to writing a
normal LaTeX document which is then PARSED BY A DCL SCRIPT to create
usually several hundred pages of LaTeX source.

Later I added the possibility to add a header or footer to each slide,
also via the DCL script.

I have seen DCL procedures with tens of thousands of lines. :-)

Simon Clubley

unread,
Jan 19, 2022, 1:19:33 PM1/19/22
to
Only in DCL, would _that_ be considered the correct answer. :-)

Time for another enhancement suggestion...

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Arne Vajhøj

unread,
Jan 19, 2022, 1:27:29 PM1/19/22
to
They can do strings but they are not great with strings.

variable rich string protection
length function against out of
strings library range access
Fortran - - -
C - + -

Arne

Arne Vajhøj

unread,
Jan 19, 2022, 1:28:41 PM1/19/22
to
On 1/19/2022 12:20 PM, Phillip Helbig (undress to reply) wrote:
> In article <ss9ba0$vb7$1...@dont-email.me>, Stephen Hoffman
> <seao...@hoffmanlabs.invalid> writes:
>> DCL, FORTRAN, C, and some other common OpenVMS programming languages
>> just aren't very good at strings.

> Then---drumroll, please---I moved from writing the LaTeX by hand (from
> templates, of course), with all the \include commands, to writing a
> normal LaTeX document which is then PARSED BY A DCL SCRIPT to create
> usually several hundred pages of LaTeX source.
>
> Later I added the possibility to add a header or footer to each slide,
> also via the DCL script.
>
> I have seen DCL procedures with tens of thousands of lines. :-)

Python or Perl would likely have been both shorter and faster.

Arne


Phillip Helbig (undress to reply)

unread,
Jan 19, 2022, 3:11:12 PM1/19/22
to
In article <61e85855$0$700$1472...@news.sunsite.dk>,
=?UTF-8?Q?Arne_Vajh=c3=b8j?= <ar...@vajhoej.dk> writes:

> > Then---drumroll, please---I moved from writing the LaTeX by hand (from
> > templates, of course), with all the \include commands, to writing a
> > normal LaTeX document which is then PARSED BY A DCL SCRIPT to create
> > usually several hundred pages of LaTeX source.
> >
> > Later I added the possibility to add a header or footer to each slide,
> > also via the DCL script.
> >
> > I have seen DCL procedures with tens of thousands of lines. :-)
>
> Python or Perl would likely have been both shorter and faster.

Including the time to install them on VMS and learn them? :-|

Arne Vajhøj

unread,
Jan 19, 2022, 9:23:58 PM1/19/22
to
No.

But that effort would be beneficial for many other problems.

Arne


George Cornelius

unread,
Jan 25, 2022, 9:05:40 AM1/25/22
to
What's wrong with the old familiar way?

$ search myfile.txt "''dsq'" ?

This has benefits as well when searching for more complex sequences:

$ pip tick="'" ; search myfile.txt "''tick'''tick'MYSYMBOL''tick'"

I don't use &symbol often because I'm not sure I understand
precisely how it differs from the ''symbol' embedded in DQ's.

George

George Cornelius

unread,
Jan 25, 2022, 9:20:46 AM1/25/22
to
To answer my own question (since my second example does not work
at all, but does seem to be ok with '' in place of '''):

The embedded ''symbol' form has its own complications.

George

Tad Winters

unread,
May 13, 2022, 1:35:05 AM5/13/22
to Phillip Helbig undress to reply via Info-vax
Just for fun.

$ QUOTES[0,16] = 10023
$ SEARCH <file> &QUOTES

0 new messages