Re: [Nolug] grepping multiple strings

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: 04 Mar 2003 00:13:16 -0600
Message-Id: <1046758396.11427.67.camel@haggis>

On Mon, 2003-03-03 at 23:33, Andrew S. Johnson wrote:
> On Monday 03 March 2003 08:58 pm, Ron Johnson wrote:
> --snip--
> > >
> > > I suppose, but if you've ever replaced a transmission youself
> > > (vs. spending $k's for someone else to do it) you know that all the
> > > bolts holding the bell housing to the block are the same size.
> > > Ratcheting all those bolts is repetitive to be sure, but is sure is
> > > convenient that one tool will do them all, esp. when you're laying
> > > under the car.
> >
> > I think that a more relevant analogy would be:
> > - the current "standard" method of "and"ing (via multiple greps") is
> > like ratcheting each bolt on one at a time.
> > - a *better* tool would be one that ratchets *all* the bolts on at the
> > same time, while still being simple to use.
>
> Even the automakers don't have such a thing. Ratcheting all the bolts
> at the same time would require that the tool be configured for that
> particular bolt pattern, and would only work on that engine/tranny
> combination, and would assume that the same number of turns would
> result in the same torque on each bolt. The analogy would be a script
> with the search strings hard-coded. It's is only useful for the single task.
> The string patterns change, and the tool has to be redesigned.

As far as the physical tool, of course there's no such implement... I
never meant to imply that there was.

As for the last 2 sentences of your reply, I heartily disagree.
Remember, it was just an analogy...

What I'm saying (obviously imperfectly) is that doing all the ANDing
with 1 tool all at once is better than doing it over many iterations.

  perl -ne 'print if /snafu/ && /snazzle/ && /wizzle/ && /wazzle/ \
     && /woo/ && /baz/ && /biz/' dmesg.txt
vs:
  grep foo bat.txt | grep snafu | grep snazzle | grep wizzle | \
     grep wazzle | grep woo | grep baz | grep biz

I'm sure that with a little bash cleverness this could be reduced to:
  grep-and snafu snazzle wizzle wazzle woo baz biz dmesg.txt

-- 
+-----------------------------------------------------------+
| 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.org
Received on 03/04/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST