Reputation: 2607
I have list of compressed files in a directory /var/log/bb e.g. console.log.1.xz, console.log.2.xz etc. I would like to grep a particular string from these files in a single command. Any ideas on how to achieve this
I have been trying like this
sudo xzcat /var/log/bb | grep 'string'
Upvotes: 0
Views: 662
Reputation: 4865
Suggesting:
grep -l 'string' $(find /var/log/bb -type f -name "*.xz")
Upvotes: 0
Reputation: 11217
Using find
find /var/log/bb -iname '*.xz' -type f -exec grep 'string' {} +
Using grep
$ grep 'string' /var/log/bb/*.xz
Upvotes: 1