Greets:
Small problem and was wondering is some one can help. I have tabular data that
is separated by spaces and want to convert it to csv format. I did some
digging and found the necessary sed scripts to convert from cvs to space
delimited text but not the other way around.
sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta'
ref: http://student.northpark.edu/pemente/sed/sedfaq4.
Sample data:
2 45.388,889 -75.872,019 waypoint.wpt1 0 0 0 0
3 45.396,796 -75.885,759 waypoint.wpt1 0 0 0 0
4 45.405,001 -75.902,138 waypoint.wpt1 0 0 0 0
desired output;
2, 45.388,889, -75.872,019, waypoint.wpt1, 0 0 0 0
3, 45.396,796, -75.885,759, waypoint.wpt1, 0 0 0 0
4, 45.405,001, -75.902,138, waypoint.wpt1, 0 0 0 0
now wrt to the "0" coordinates whether they are comma separated or not is not
important.
Any insight would be appreciated.
--
/ch