Link to home
Start Free TrialLog in
Avatar of southpau1
southpau1Flag for United States of America

asked on

Linux script for searching logs

I have 31 log files in a directory.  I want to search each log file for a specific string.  It would be nice to search all 30 with a single command.  For output I would just like a count of the matches.  How can I accomplish this?

Directory name: /logs
Log file naming convention:
system.log  -  (today's log)
system.log.* -  (previous 30 day's logs where * is the number 1-30)
SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try
grep "STRING" system.log*

Open in new window


Use -c option to count matches
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial