[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: search subdirectories



Reply to note from Judith Davidsen  Fri, 11
Jan 2002 18:23:28 -0500

> Is there anything in Xy4.018 or U2 that will allow me to
> search, with one command, every subdirectory of a directory for
> a string,and have it open the relevant file(s) and land right
> on the string?

Judith:

The U2 routine to use is SWEEP. It allows any native command or U2
routine to operate starting in the current directories and then down
through all subdirectories. SWEEP will accept either the native
SEarch command or the enhanced U2 SEarch command, but the usages
differ. With the native command, the usage is:

SWEEP se d:\path\*.*"search_term"

The native SEarch across files has some annoying quirks. You have
to launch the command from an empty screen (no file open). When you
choose to open a file, you're left, rather unhelpfully, at the top
of the file, not at the last found instance of the search_term. The
U2 SEarch command overcomes these limitations.

The syntax for the U2 SEarch command is:

SWEEP JM2.se[sv50,d:\path\*.*"search_term"]Q2

The only variable parts of this command are d:\path\*.* and
"search_term". Everything else must appear literally, just as you
see it above. You don't need to use "" as the separator; as with
the native SEarch command, any separator that doesn't occur in the
search_string will do.

For further information, see the Help screens on SWEEP and Global
Search: command HELP SWEEP and HELP Global Search.
The pseudo-XPL used in SWEEP's U2 usage is XMACRO code. It may not
be pretty to look at, but it puts the power of XPL right up there on
the command line. Command HELP XMACRO for details.

--
Carl Distefano
cld@xxxxxxxx
http://users.datarealm.com/xywwweb/