I am new in the Linux world and I have an issue
I have a lot of files, like 20 of them, which start with the same name only changing a few characters at the end of the name. All this files are in .tar.gz
format.
In this files there are lots of information which are written like this
1234|123415|12356|abcd|abcde|....|
I'd like to grep this files looking for matches in all of them, I have more than one pattern and this is where my problem starts
Due to the fact that these are .tar.gz files I cannot make a regular grep, and I need a zgrep for this, therefore I found the next code
zgrep -a *pattern* *file*
Which works fine, but only with one pattern, if I try to use it with multiple patterns it just doesn't work.
Can you help me to make something like the next code works:
zgrep -a *pattern1* *pattern2* *file*
When matching for multiple patterns, I find it easier to use the -E extension which allowsme to use regexes. Then I can do something like:
zgrep -a -E '*pattern1*|*pattern2*|...' *file*
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