I basically want to do this:
grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log
...with of course the filename being example.com.2008-09-27-11:21:30.log
I'd then put this in crontab to run daily.
I basically want to do this:
grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log
...with of course the filename being example.com.2008-09-27-11:21:30.log
I'd then put this in crontab to run daily.
The verbose method:
grep 'example.com' www_log > `date +example.com.%Y-%m-%d-%H:%M:%S.log`
The terse method:
grep 'example.com' www_log > `date +example.com.%F-%T.log`
Here is another way, that I usually use:
grep 'example.com' www_log > example.com.`date +%F-%T`.log
Backticks are a form of command substitution. Another form is to use $():
$(command)
which is the same as:
`command`