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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Read and append lines.

Status
Not open for further replies.

Dorga

MIS
Jul 30, 2003
101
NZ
Ok, so I need a sed or awk solution please..

Format of the files I am working with..

server235
,Pin=ALL_LOCAL_DRIVES
server236
,Pin=C:\,E:\

......skip a few.

server1000
,Pin=G:\,Z:\

So I have the data beaten this far into shape, but I can not get the two lines merged.. I am stuck in Windows, and using ported commands.. the pain!

I have tried various forms of appending next line, and appending previous line based on various searches..

I just need to read the above data, and have this output, and its kicking my arse.

server235,Pin=ALL_LOCAL_DRIVES
server236,Pin=C:\,E:\
server1000,Pin=G:\,Z:\

I can easily add text to the begenning/end of the server line to allow searching, and the , is always at the begenning of the following line... There is never a 3rd line, just the server name, and the Pin= bits..

Thanks for ANY help..
 
If there are always two lines per server:

Code:
awk '{printf $0; getline; print}' inputfile


Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top