[NTLUG:Discuss] Finding different strings in a single file
Robert Pearson
e2eiod at gmail.com
Fri Dec 7 00:39:59 CST 2007
On Dec 6, 2007 11:26 PM, Leroy Tennison <leroy_tennison at prodigy.net> wrote:
> I have a situation where I need to check for several strings in a given
> file. For example, are the following listed in /etc/services:
>
> chargen
> echo
> discard
> daytime
>
> What I've done so far is grep for each one individually but it's getting
> old. I could write an awk script but I'm not sure that's less painful.
> Is there a more elegant method? In looking at 'find' I noticed xargs
> but it's man page was close to totally unilluminating to me.
"egrep" is a solution for this.
egrep -i 'chargen|echo|discard|daytime' /etc/services
More information about the Discuss
mailing list