home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] sed

On Tue, 2008-11-18 at 18:21 -0500, Chris h wrote:
> 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
> 

Seems like a lot of work for me.  Try:

sed -e 's/  */,/g'


-- 
Just my 0.00000002 million dollars worth,
  Shawn

The map is not the territory,
the dossier is not the person,
the model is not reality,
and the universe is indifferent to your beliefs.


replies

references

message navigation