seperate cloumns by AWK

January 12, 2012 at 12:07:34
Specs: Macintosh
Hey guys,
I am very new for awk language.My question is that I have some data like this :NW78-02 51614034.70S3300627.10E,i want to seperate as BGR78-02 51 61 40 34.70 S 330 006 27.10 E
11 columns.Any ideas to solve it?Thank you so mucn!!!

See More: seperate cloumns by AWK

Report •

January 12, 2012 at 14:07:04
The first part of your requirement is easy enough; simply replace ":NW" with "BGR":

echo ":NW78-02 51614034.70S3300627.10E"|awk ' { gsub(":NW","BGR"); print } '

But the only algorithm that I see go use is that, in the string, insert a space at position 12, a space at position 15, etc, etc.

Is this what you want?? I just do not see any other pattern.

Report •

January 13, 2012 at 01:40:56
Hey nails,Thank you for reply.but i still don't understand the second part.I mean to separate the data NW78-02 51614034.70S3300627.10E as 11 columns :BGR78-02 51 61 40 34.70 S 330 006 27.10 E ,Could you write down the code for me?Thanks a lot!

Report •
Related Solutions

Ask Question