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!

merge lines 1

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

I have the following output :
Physical Location: P1-M1.15
Size....00000128
Physical Location: P1-M1.1
Size....00000128
Physical Location: P1-M1.16
Size....00000128
Physical Location: P1-M1.2
Size....00000128

I want to display:

Physical Location: P1-M1.15 Size....00000128
Physical Location: P1-M1.1 Size....00000128
Physical Location: P1-M1.16 Size....00000128
Physical Location: P1-M1.2 Size....00000128

Thanks


Long live king Moshiach !
 
Something like this ?
awk '/Physical/{printf "%s",$0;getline}1' /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
 
nawk '{ printf("%s%s", $0, !(FNR % 2) ? "\n" : "") }' inputFile

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
good one, futurelet!

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks, Vlad. As usual, I made it longer than it had to be.
Code:
ORS=(NR%2)?FS:RS
 
Could some one please explain the below notation, as in the above example.

ORS=(FNR%2)?



Thanks
 
As in C, [tt]ORS=(NR%2)?FS:RS[/tt] means:
[tt]ORS= (if (NR%2) FS else RS)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top