I have the following line:
Jan 13, 2014 1:01:31 AM
I want to remove the seconds part of the line. The result should be:
Jan 13, 2014 1:01 AM
How can this be done ?
Use parameter expansion:
t='Jan 13, 2014 1:01:31 AM'
ampm=${t: -2} # last two characters
echo "${t%:*} $ampm" # remove everything after the last :