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

Formatting output from lines 2

Status
Not open for further replies.

cryptoadm

MIS
Nov 6, 2008
71
US
123
xyz

abc

ade

2324
lmn

689
vms

hmn

321
tgh

I need to format the output as the second line:first line - for exampe:
xyz:123
abc:
ade:
lmn:2324
vms:689
hmn:
tgh:321

Thanks!
 
A starting point:
awk '!(NR%2){print $0":"x;next}{x=$0}' /path/to/input >output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Try this:
awk 'NF == 0 {next}; {if($0 ~ /^[0-9]/) {TMP1 = $0; if(getline TMP2 > 0) print TMP2":"TMP1}}; {if($0 ~ /^[a-z]/) print $0":"}' /filename
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top