The UNIX and Linux Forums  


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
Left join on files using awk

Quote:
File_A:
NY
NJ
PA
CA
VA
TN
Quote:
File_B:
NY hello
NJ 3
CA 1
VA 5
Quote:
ouptut:
NY,Found
NJ,Found
PA,
CA,Found
VA,Found
TN,

Code:
nawk 'NR==FNR{a[$1];next} {if($1 in a) print $1,"Found" else print}'  OFS="," File_B File_A

The above code is not working help is appreciated