in reply to Re: Need help copying "logs" to another file.
in thread Need help copying "logs" to another file.
Note that the code above is doing roughly the same as:$ ls /path/*.log | grep -v filename_exclude_pat | xargs grep -h line_include_pat >output.txt
right, but note also that the above is doing roughly the same as (a bit expensive as it process every line of unneeded files even if skip them):
perl -lne 'next if $ARGV=~/filename_exclude_pat/;print if $_=~/line +_include_pat/' *.log > output.txt
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Need help copying "logs" to another file. -- oneliner
by haukex (Archbishop) on Mar 29, 2017 at 13:17 UTC |