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
$ t='2009-12-03 12:38:15' $ a=(`echo $t | sed -e 's/[:-]/ /g'`) $ echo ${a[*]} 2009 12 03 12 38 15 $ echo ${a[3]} 12