How would you parse a date in bash, with separate fields (years, months, days, hours, minutes, seconds) into different variables?
The date format is: YYYY-MM-D
YYYY-MM-D
Pure Bash:
date="2009-12-03 15:35:11" saveIFS="$IFS" IFS="- :" date=($date) IFS="$saveIFS" for field in "${date[@]}" do echo $field done 2009 12 03 15 35 11