Issue
I have a directory of about 10 files with *.tar extension.
The 10 files have the following file name pattern.
File001.tar
File002.tar
File003.tar
..
File010.tar
Is there a way I can grep all 10 files for "Error" passing a wildcard to the filename in a terminal. How do I do this and also how would I do this if all the files have the extension "*.tgz" ?
Solution
This should make it:
grep "Error" /your_dir/*tar
Or also
grep --include="*tar" "Error" /your_dir/*
For tgz
files, use zgrep
.
zgrep "Error" /your_dir/*tgz
Or also
grep --include="*tgz" "Error" /your_dir/*
Answered By - fedorqui 'SO stop harming'