My goal is to convert dates from my apache logs in the format "12/Nov/2015:23:28:22" to epoch format. Can this be done using the date command or do I need to parse and extract the information?
It seems my date
command wants -
instead of /
between the date parts and that to be separated by a space from the time part. So I used sed
to do the conversion like so:
date -d "$(echo '12/Nov/2015:23:28:22' | sed -e 's,/,-,g' -e 's,:, ,')" +"%s"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With