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!

getting data from next line and printing 1

Status
Not open for further replies.

CooperS

Technical User
Aug 19, 2002
7
GB
I have a datafile

1000 sandstone
1010 clay
1015 salt
1020 salt

I want to process this file to create the following output

1001 1010 sandstone
1010 1015 clay
1015 1020 salt

I would appreciate any suggestions as to how to achieve this with sed/awk

Thank you
 
REVISION
This is the required output (1000 not 1001)

1000 1010 sandstone
1010 1015 clay
1015 1020 salt
 
Something like this ?
awk '{if(NR>1)print s,$1,t;s=$1;t=$2}' /path/to/input

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

Part and Inventory Search

Sponsor

Back
Top