From FreeBSDwiki
Revision as of 05:41, 10 July 2005 by Smortex (Talk | contribs)
Jump to: navigation, search

note on the rollback: I strongly prefer showing a pipe to grep rather than the -l argument because they both accomplish the same thing, but piping to grep is a universal tool than can be used with any command or process. It's a good habit to learn using tools and skills that are universally applicable as opposed to stuff that's only applicable to one particular task, unless there is some marked advantage to using the more proprietary method of doing things.

If you know of some particularly good reason to use the -l argument instead of piping to grep, by all means let me know here. --Jimbo 19:23, 9 Jul 2005 (EDT)

The goal is just avoiding to use two processes when only one is needed... More, I tried this :

Script started on Sun Jul 10 11:35:19 2005
# time portversion -l '<' > /dev/null 
portversion 1.90s user 0.68s system 86% cpu 3.001 total
# time portversion | grep '<' > /dev/null
portversion  2.68s user 0.88s system 69% cpu 5.102 total
grep '<' > /dev/null  0.00s user 0.00s system 0% cpu 5.100 total
Script done on Sun Jul 10 11:36:23 2005

I do not know how it work internaly, but I gess that the "-l" argument changes the search algorithme.

But I agree with your point of view... grep has to be known by the users ! The "-l" flag may sometimes be preferable, for a low system for example...

Personal tools