This question already has an answer here:
I have a use-case to process following file types:
1 - mylog_1.log 2 - mylog_2.log.gz
I have to run two different text processing commands on each of them as follows:
cat mylog_1.log | grep text | sort | uniq -c zcat mylog_2.log.gz | grep text | sort | uniq -c
(cat, grep, awk and sed are the frequently used commands)
Is there a way to process both file types in a single command without unzipping the file?