My input file is as follows:
12/13/2011,07:14:13.724,12/13/2011 07:14:13.724,231.56.3.245,LasVegas,US
I wish to get the following:
<
You were near but some characters are special in sed (in my version, at least): {
, }
, (
, )
, but not :
. So you need to escape them with a back-slash.
And \1
takes expression between paretheses, it should be the first part until seconds, not the second one.
A modification of your version could be:
sed "s/\([0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\)\.[0-9]\{1,3\}/\1/g" input_file.csv > output.csv