Reputation: 318
I have time in format hh:mm:ss in a variable and I need to change it in hhmmss format for processing using shell script. eg. time=12:12:10 and I want it in variable new_time in format 121210. Please suggest command.
Upvotes: 0
Views: 86
Reputation: 733
you can use sed command
m='12:12:10'
echo "$m"|sed 's/\://g'
output will be
121210
Upvotes: 0
Reputation: 70822
time=12:12:10
echo ${time//:}
121210
Upvotes: 1