On Mon, 2003-03-03 at 11:58, Andrew S. Johnson wrote:
> On Monday 03 March 2003 11:41 am, Ron Johnson wrote:
> > On Mon, 2003-03-03 at 07:53, Scott Harney wrote:
> > > Ron Johnson <ron.l.johnson@cox.net> writes:
> > >
> > > Egrep is your friend.
> > > 'egrep "this|that" filename ' for an 'or' grouping. You need to
> > > invoke egrep and you need to use the double quotes to keep the
> > > shell from interpreting the vertical bar as a pipe.
> > >
> > > For 'and' situations, just use stdout and pipes to narrow
> > > your output results:
> > > grep this filename | grep that
> > > This prints out any lines containing 'this' and pipes them into the
> > > second grep which narrows that list down to lines containing 'that'.
> > >
> > > To do 'and' greps in a single command. you need 3rd party tools:
> > > perl -ne 'print if /this/ && /that/ && /dese/ && /dose/' filenames
> > > (sed & awk could also be used)
> >
> > Thanks. I wonder why egrep doesn't have an "and" operator also. That
> > seems like a big oversight.
>
> Actually, you could include a wildcard ".*" in your search string, which means
> any number of any characters match. Try this: egrep "this.*that" filenames.
> Isn't this AND?
Yes, but... only if "that" always follows "this" on each line.
-- +-----------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | The difference between Rock&Roll and Country Music? | | Old Rockers still on tour are pathetic, but old Country | | signers are still great. | +-----------------------------------------------------------+ ___________________ Nolug mailing list nolug@nolug.orgReceived on 03/03/03
This archive was generated by hypermail 2.2.0 : 12/19/08 EST