Reputation: 15
I have a file in UNIX which has a character in the time stamp
2016-06-24T14:00:00.1000000;True;
I want to replace the T
in the time stamp with blank. I used sed
but it didn't work.
sed -i.bak 's/[0-9]T[0-9]/ /g' filename.csv
When I run the script it is converting the output to:
2016-06-2 4:00:00.1000000;True;
It's lost the 4 before the T and the 1 after it.
Upvotes: 0
Views: 79
Reputation: 14949
You need to capture digits before and after T
. Then, you do not need g (global substitution).
sed 's/\([0-9]\)T\([0-9]\)/\1 \2/' file
Upvotes: 2