Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splitting a line into two columns 1

Status
Not open for further replies.

Butterfly78

Technical User
Oct 25, 2006
1
ES
Hi,

I'm very new to awk, actually I think it would be the fastest manner to manage this problem:

I have a file like this

19000.0192 1 19000.0336 2 19000.0481 3 19000.0625 4 19000.077 4 19000.0914 3

in a singe line, and I'd like to split into two columns. Second column range between 1 and 4 characters.

Thank you so much in advance!
B.

 
A starting point:
awk '{for(i=1;i<NF;i+=2)print $i,$(i+1)}' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top