grep, etc

Bob Stockler bob at trebor.iglou.com
Wed Aug 18 10:28:59 PDT 2004


On Wed, Aug 18, 2004 at 10:02:25AM -0700, Bill Campbell wrote:
| On Wed, Aug 18, 2004, Bob Stockler wrote:
| >On Wed, Aug 18, 2004 at 11:07:34AM -0400, Bob Stockler wrote:
| >| 
| >| I would guess that "mawk" would be faster than "grep" in certain
| >| circumstances, especially when searching a large file, because
| >| it could be made to exit after reading the lines to be matched.
| >
| >Example:
| >
| >  [trebor] ~bob: time grep '^factory$' /usr/dict/words
| >  factory
| >
| >  real    0m0.11s
| >  user    0m0.06s
| >  sys     0m0.01s
| >  [trebor] ~bob: time mawk '/^factory$/{print;exit}' /usr/dict/words
| >  factory
| >
| >  real    0m0.06s
| >  user    0m0.01s
| >  sys     0m0.00s
| 
| The ``mawk'' script cheats as it exits when it finds a match while grep
| passes the entire file.

That's the point.

Bob

-- 
Bob Stockler - bob at trebor.iglou.com
Author: MENU EDIT II - The BEST Creator/Editor/Manager for filePro User Menus.
Fully functional (time-limited) demos available by email request (specify OS).


More information about the Filepro-list mailing list