Использование awk:
$ awk 'NR==FNR{a[$1]=$2;next}($1 in a){print $1, a[$1]<$2}' file1 file2
Выход:
AA 1
BB 1
CC 1
Объяснил некоторые:
$ awk ' # using awk
NR==FNR { # process first file
a[$1]=$2 # hash to a, $1 is the key
next # process the next record
} # second file processing follows
($1 in a) { # if $1 was present in file1
print $1, a[$1]<$2 # print $1 and 0/1 whether file1 entry was less or not
}' file1 file2