The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-22-2009
pinnacle pinnacle is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 182
awk reading many fields to array

I want to read $3,$4,$5,$6,$7 of fileA in array and when
fileb $1 = fileA $4
the i want to print array and few fields from fileB.

This should work but has some syntax error.

Code:
nawk -F, 'FNR==NR{a[$1]=[$3,$4,$5,$6,$7];next} a[$4]{print a[$4,$1,$2,$3]}' fileB fileA

Appreciate if someone can correct this.