[SunHELP] Grep Help
Lance Sequeira
sunhelp at sunhelp.org
Wed Sep 19 14:29:59 CDT 2001
Hey Shain,
I have a practical solution, that does not answer your
question from an academic perspective. But you could
try the following:
Put all the patterns that you want to search for in a
file, say patterns.text; each pattern on a separate
line.
Write a shell script, say SGrep, with the following
following content:
#!/bin/ksh
while read Pattern
do
grep "$Pattern" ${2}
done < ${1}
Run the script as follows:
> SGrep patterns.text yourfiletosearchin
--Lance.
--- Shain Miley <smiley at tvdata.com> wrote:
> In this instance I do not need to go into
> subdirectories, there is only
> one file that I will be looking at. I am looking
> for a way to search
> one file for many many things. I thought that
> pattern list was what
> I was looking for but now I am unsure.
>
> Shain
>
>
> "Fogg, James" wrote:
>
> > I highly recommend rgrep (recursive grep), esp.
> since it can search
> > subdirectories.
> >
> > > -----Original Message-----
> > > From: Shain Miley [mailto:smiley at tvdata.com]
> > > Sent: Tuesday, September 18, 2001 6:52 PM
> > > To: sunhelp at sunhelp.org
> > > Subject: [SunHELP] Grep Help
> > >
> > >
> > > Hi,
> > > I need to search for about 15 things (list of ip
> addresses
> > > and hostnames) in a file useing grep. Do I have
> to use grep
> > > 15 different times or can I give
> > > multiple search options to one grep command? I
> tried 'grep
> > > 'a b c d e' file' but I get an error: grep: RE
> error 41: No
> > > remembered search string. Any
> > > ideas? i have tried using examples I found on
> the web but it
> > > looks like that does an exact search or
> something other than
> > > what I need. Thanks.
> > >
> > > Shain
> > >
> > > _______________________________________________
> > > SunHELP maillist - SunHELP at sunhelp.org
> > > http://www.sunhelp.org/mailman/listinfo/sunhelp
> > >
> > _______________________________________________
> > SunHELP maillist - SunHELP at sunhelp.org
> > http://www.sunhelp.org/mailman/listinfo/sunhelp
>
> _______________________________________________
> SunHELP maillist - SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
More information about the SunHELP
mailing list