How do I round it to the next 5th interval?
# date
Sat Oct 13 22:09:25 IST 2012
# date '+%H-%M'
22-09
the output should be
22-10
When the minute is 58 it should round to 00 and not 60 though.
You can tweak this:
date '+%H-%M' | awk -F- '{ while( $2 % 5 != 0 ){ $2++ }; print $1, $2 % 60 }'
Example:
$ date '+%H-%M' | awk -F- '{ while( $2 % 5 != 0 ){ $2++ }; print $1, $2 % 60 }'
18 55
How it works: