I am trying to compare 2 dates in the format
YYYY:MM:DD HH:MM:SS by using the date (bash) command. My problem is that the date command only uses the date format (as far as I know)
YYYY-MM-DD HH:MM:SS. I was trying to use sed with regular expressions to replace the first 2 occurrences of
- but I was not able to get it to work. I’m only getting 2018.
date1="2018:01:16 12:25:35" echo $date1 | sed 's/\([0-9]*\).*/\1/'
I’ll take any possible suggestions and thank you.