If you want the records that don't match also:
awk 'NR==FNR{x[$2]=$NF;next}
$1 in x?$0=$0" "x[$1]:1' FS="[~ ]" file2 file1
Without them:
awk 'NR==FNR{x[$2]=$NF;next}
$1 in x?$0=$0" "x[$1]:0' FS="[~ ]" file2 file1
Use nawk or /usr/xpg4/bin/awk on Solaris.
Last edited by radoulov; Oct 2nd, 2007 at 9:24 am.
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Offline 54 posts
since Feb 2007