The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Left join on files using awk
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Left join on files using awk
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
1
(
permalink
)
05-27-2009
pinnacle
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
pinnacle
View Public Profile
Find all posts by pinnacle
Find pinnacle's past nominations received
Find pinnacle's present nominations given