Cshell question: taking wordlists as a single string
Andy Clews
andy at syma.sussex.ac.uk
Tue Aug 14 22:58:11 AEST 1990
I have a Csh script called "whatnews" which takes words as arguments and
searches the file /usr/lib/news/newsgroups for lines containing any one
of those words, the requirement being to show users what newsgroups are
there that may be something to do with the searched word. It is not
case sensitive (i.e. it uses fgrep -i)
whatnews biology
"whatnews" then proceeds to show me all lines in /usr/lib/news/newgroups
that contain the string "biology". If several words are supplied as a
list, whatnews searches the file for each of these words. The
difficulty arises because I want to do (for example)
whatnews "bug reports"
where the intended effect is to search out all lines containing the
string "bug reports". At the moment it splits this up into "bug" and
"reports" and does two searches. This is because the script contains a
foreach i ($*)
loop for repeated searches. Quoting (single or double) doesn't help.
Basically, then, can Cshell cope with word-lists as single arguments, or
must I write a C program to do the job (or try sh or ksh?)
No joy as yet with TFM. Any help appreciated; email probably best. I
will summarise if possible. Thanks for listening.
--
Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England
JANET: andy at syma.sussex.ac.uk BITNET: andy%syma.sussex.ac.uk at uk.ac
More information about the Comp.unix.questions
mailing list