awk 'NR==FNR{c[$1]++;next};c[$2] >0' file1 file2
Is it possible to get the negative of this teh above line? i.e., to get the
unmatched lines
There might be more elegant and/or readable solutions to this task,
but taking your awk script as a starting point, this should give
you the result you want:
awk 'NR == FNR { c[$1]++; next } \
$1 ~ /^[0-9]+/ && c[$2] == 0' \
file1 file2
"$1 ~ /^[0-9]+/" will get rid of file2's header, including the blank
line that follows it, and "c[$2] == 0" will be true for any number in
the second column of file2 that had not been inserted into the array
when processing file1.
Patrick
--
If you'd like to send me a private message, make sure to remove
the "_lists" part from my address.