in reply to searching a string in many files
perl -ne 'print "$ARGV: $_" if /10450676/' nc05*/kn
:D
P.S. Please note that based on my own uses of perl vs grep on gigabytes worth of log files, perl is much, MUCH faster than grep. And another note, unix shells have limits to the length of the command line you submit, that is, the length of the line after it interprets your glob 'nc05*/kn'. If you only have 10 or 20 directories, I wouldn't worry, if you have 100 or 1000, you will probably reach that maximum(Don't worry, I know at least bash will complain.) Get familiar with xargs for that case:
ls nc05*/kn | xargs -n 10 perl -ne 'print "$ARGV: $_" if /10450676/'
Addendum: Updated to make perl print the actual filename just like grep would.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: searching a string in many files
by revdiablo (Prior) on Jun 25, 2003 at 21:08 UTC | |
by pzbagel (Chaplain) on Jun 27, 2003 at 18:05 UTC | |
|
Re: Re: searching a string in many files
by Anonymous Monk on Jun 25, 2003 at 21:10 UTC |