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 05-27-2009
pinnacle pinnacle is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 182
Multiple file lookup using awk

I want to lookup filea with fileb,filec and filed.
If entry in filea exist in fileb and filec mark Y and then if entry in filea exist in filed mark as Y.
Final output should have all the entries from filea.

Quote:
filea:
abc
def
ghi
jkl

fileb:
abc,tt
def,kk

filec:
abc,ii
ghi,nn
filed:
ghi,aa
jkl,mm

output:
filea,fileb&c,filed
abc,Y,
def,,
ghi,,Y
jkl,,Y
This prints only matching entries from file a in fileb i want all entries from filea if it exists or not in fileb

Code:
nawk -F"|" 'NR==FNR{a[$1];next} $1 in a{print $1} filea fileb