How do I grep for a string recursively through all .gz files in all directories and subdirectories?
|
|
migrated from stackoverflow.com May 25 '10 at 4:18
|
@Steve Weet is almost there. The use of /dev/null as an additional argument is a nice way to force the filename to be shown (I'll remember that, thanks Steve) but it still runs the exec for every file found -- a huge overhead. You want to run zgrep as few times as you can, getting the most out of each execution:
On Mac OS X, you can achieve the same effect without xargs:
|
|||||||||
|
|
@aioobe is almost there. The command will do the job but won't tell you the file name The following should tell you the filename as well:
The addition of EDIT Further research reveals that for my machine (OS/X) the |
|||||||
|
So something like
|
|||||||||
|
|
The following works a treat in
It may also work in |
|||
|
|