I can use the following command to search log files over the past 10 days:
find . -type f -mtime -10 |xargs grep -i -n 'exception' 2> /dev/null
But i want to further limit the search for lines in the file that are logged between 6am and 6pm. I’m wondering how i can modify the grep command to filter these if the lines look like this:
2012-09-04 03:50:41,658 [MainLogger: ] EXCEPTION AppLog - some exception 1
2012-09-04 10:01:32,902 [MainLogger: ] EXCEPTION AppLog - some exception 2
2012-09-04 15:39:51,901 [MainLogger: ] EXCEPTION AppLog - some exception 3
2012-09-04 18:12:51,901 [MainLogger: ] EXCEPTION AppLog - some exception 4
In the above case on lines 2 and 3 should be returned since they are between 6am and 6pm.
any help would be appreciated
One easy ugly way to do it could be adding a lot of greps, like this :
Or more concisely :