[NTLUG:Discuss] in a world where grep doesn't have the -m (match) option..
Rick Renshaw
bofh69 at yahoo.com
Wed Mar 26 06:49:23 CDT 2008
--- Steve Baker <steve at sjbaker.org> wrote:
> As soon as 'head' has read enough input to satisfy your demand to
> display one line, it'll exit. That causes a 'broken' link on the output
> of 'grep' which will crap out and die as a result. So the only wasted
> time is the time grep spends searching onwards while head displays your
> line of data.
If you're searching for a string that only occurs a few times, specifically; less than a buffer
full of output, then the grep will complete before head gets the less than full buffer to process.
So if you're just searching for the first hit on something that occurs a lot, this will save
time. If you're searching for a string that only occurs 2-3 times, this probably won't save much time.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the Discuss
mailing list