Just a general question about the use of the grep command. I can never seem to get it to work quite right, and the man pages for it don't really explain it very well. What I'm trying to do is have a daily job set up to pull the previous days worth of entries from various log files (httpd, system logs, etc). I try to test out various syntax combinations, but I can't ever seem to get grep to show just 1 days worth when sorting by date.
So, for example, the Apache logs store the date like this:
I'm trying to view the previous days logs with something like this:
grep "date --date=yesterday '+%d/%b/%G/%T'" /var/log/httpd/access_log
With that, I get nothing returned, and I don't know what to do to sort it by date.
Also, if I can get my results to come back properly, I'd like to write them out to a text file with the date as the filename. I believe grep can pipe it to a file, but again, I'm not sure on the syntax. Can I just echo it to a file, or is there a better way?
If it helps any, this job will be running on a Fedora 3 system. Any help on this will really be appreciated.