ls -ltr|grep 'Mar 4'| awk '{print $9 }'|zcat -fq |grep 12345
I want to find all files modified on a certain date and then zcat them and search the fiels for a number string.
the above doesn't work because it searches the file name for the string not the file itself.
Any help?
M
Use xargs to run the grep on the filenames output by awk:
ls -ltr | grep 'Mar 4' | awk '{print 9}' | xargs zcat -fq | grep 12345
Or, I guess, run the rest of the pipe from awk itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With