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

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



> On Fri, 02 Dec 2011 01:25:16 +0100, 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.

                                       -- A.
--
Andrew Reid / reidac@bellatlantic.net


Reply to: