I have a file of a table, the columns of which were separated by spaces. I wrote the following bash script to convert the spaces to commas:
#!/bin/bash for f in /home/foo/*; do i=`basename $f` i2=${i%.*} cut -f 1,2,3,4 < $f | tr -s [:blank:] ',' > $i2.csv done But I missed something that my datetime has a space between the date and time, and now there is a comma there. The datetime's comma is the third one, is there any way to replace the third comma for all the rows with a space in linux?
sed 's/,/ /3'maybe? I'm not sure what your input file really looks like.6000,0,2012-01-01,08:00:00,9,foo,x,0.123next rows would be the same just different data