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

file manipulation 2

Status
Not open for further replies.
Apr 13, 2004
316
US
I have a file that contains:
Adapter=ent0
NodeName=1
Adapter=ent1
NodeName=1
Adapter=ent2
NodeName=1

I need it to contain this:
Adapter=ent0;NodeName=1
Adapter=ent1;NodeName=1
Adapter=ent2;NodeName=1

Thanks.
 
nawk '{printf("%s%s", $0, (FNR%2) ? ";" : "\n")}' file

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
screwloose,

This should work as well:

awk '{getline a; print a";"$0}' filename

John
 
Oops...that's backwards. It should be:

awk '{getline a; print $0";"a}'

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top