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.
In reply to Re: searching a string in many files
by pzbagel
in thread searching a string in many files
by tos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |