[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Grepping style (was Re: Re (2): Laptop with external display running X11.)



Andrew Reid wrote:
> > deloptes wrote:
> > > cat /var/log/Xorg.0.log | grep EE
> > 
> > What's the purpose of this superfluous "cat" (and the pipe)?
> > 
> > grep EE /var/log/Xorg.0.log
> 
>   I noticed that too -- I actually do this all the time, and I'm 
> not 100% sure why.  It's true that sometimes the input to grep is
> not a file, but the output of some script.
> 
>   I can rationalize that "(thing-which-generates-data) | grep (pattern)" 
> will *always* work, and is thus preferred to "grep (pattern) (thing)",
> which only works on files, but I don't really know if that's the
> reason.

There is no reason for it.  People just do silly things.  This one has
been persisting on the net for years.  And there has been an awared
called the Useless Use of Cat award just for that purpose.

  http://www.google.com/search?q=useless+use+of+cat

That gratuitiously extra cat process is just wasteful and inefficient.
Don't do it!

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: