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!

Pasting two files with equal number of records

Status
Not open for further replies.

billbose

Programmer
Jan 15, 2001
66
US
Hi awk gurus,

I have 2 files with equal number of records with different sizes.
example is as follows:
1st file:
111111111111111
11111111
111
1111111111111

2nd file:
2222222
2222
222222
22222222222

Using the unix paste command i get the undesired o/p as follows.
Undesired output:
111111111111111 2222222
11111111 2222
111 222222
1111111111111 22222222222

But my desired output would be:

1111111111111112222222
111111112222
111222222
111111111111122222222222

Pls help.
TIA.
Regards,
Bill
 

awk 'BEGIN{
while( getline < 111) {
arr[ ++ii] = $1
}
}
{
print arr[ NR] $1
}' 222

Succes Bill Gregor.Weertman@mailcity.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top