i have a string containing date and time as timestamp= 12-12-2012 16:45:00
I need to reformat it into timestamp= 16:45:00 12-12-2012
How to achieve this in shell script?
Note Please : variable’s value is 12-12-2012 16:45:00 and timestamp is the name of variable
#!usr/bin/expect
set timestamp "16:45:00 12-12-2012"
Now what should i do so value of timestamp will become 12-12-2012 16:45:00
script extention is .tcl example test.tcl
Using sed:
this command works on lines containing the pattern
number-number-number whitespace antyhing. It simply swaps thenumber-number-numberpart\([0-9]*-[0-9]*-[0-9]*\)with theanythingpart\(.*\), also keeping the original whitespaces\([ \t]*\). So the replace part of sed is\3\2\1, which means the third part, white spaces, and the first part.Same logic with tcl: