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

column extract and merge

Status
Not open for further replies.

pearlofperls

Technical User
Apr 5, 2007
24
US
I have :
5 columns in file 1
11 columns in file 2
file 1 has more lines than file 2
cols 1, 2, 4, match info between the two files
based on the critieria of matching cols i want to extract cols 3,5 from file 1 and add them with file 2

I think this code is close to what im looking to do

awk 'FNR==NR{a[$1,$2,$3]=$4" "$5;next}
{ print $1,$2,$3,a[$1,$2,$3]}' file2 file1

 
That's great you have some awk code to use as a reference; if you want help with it, working or not, post the perl code you're working with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top