With this awk
it can be easier:
$ awk -F'[ ,]' '{print $2, $4"."$5}' file
12:59:01 26.668
12:59:31 26.668
13:00:01 26.668
13:00:31 26.668
13:01:01 26.668
13:01:31 26.668
-F'[ ,]'
sets two possible delimiters: space and comma.print $2, $4"."$5
prints the 2nd, 4th and 5th fields based on those delimiters.
Regarding why your script did not work, it is just because you added -f tmp.csv
unnecessarily.
$ cut -d ' ' -f2 a | cut -d ',' -f-1,3- | awk -F"," '{print $1 " " $2 "." $3}' | sed 's/"//'
12:59:01 26.668
12:59:31 26.668
13:00:01 26.668
13:00:31 26.668
13:01:01 26.668
13:01:31 26.668
Also you use -f tmp.csv
and then > tmp.csv
which does not make sense. Note a file cannot be used as stdin and stdout at the same time.