grep on both zip and non zip files

when i do ls -ltr i see bunch of .gz files says 123.gz and 456.gz
and bunch of no gz files say 789.log etc

how to grep on say "testing" on both zip gz files and non zip files

grep "testing" 789.log

zgrep "testing"  123.gz

not sure how to combine above two together

also how search today log between 10 am to 11 am for that "testing" word in log?
please advise
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can just use zgrep for both. zgrep will search plain text as well as compressed files
zgrep "testing" 123.gz 789.log
zgrep "testing" *.gz *.log
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
If you're searching may text + .gzip files, you can always do this in your shell startup file...

alias grep=zgrep

Open in new window

gudii9Author Commented:
zgrep "testing" 123.gz 789.log
zgrep "testing" *.gz *.log

in the result how to know whether it found in .gz file or .log file

please advise
Maximize Customer Retention with Superior Service

The IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more to help build customer satisfaction and retention.

The search term shows up as

123.gz: Filename followed by a colon, then whatever the line is here that includes your search term "testing"
789.log: another line with the word testing in it.

You should probably just run the command to see what you get.
gudii9Author Commented:

has 10 different files(file1,file2...file10) which it list one of that file rather than saying it as 123.gz
some kind of relative path would have helped like
found testing at line 159
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Seems like your original question has been answered.

Go ahead + close this question + open another question related to your last update. Also provide more detail, as your last update requires much more detail for an answer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.