これはうまくいくはずです:
# Set the input field separator to "|"
awk -F'|' '
# Load the second file into an array called "a". NR==FNR allows us to perform this action
# until first file is complete
NR==FNR { a[$0]; next }
# We check the existence of first and second column of first file in array. If it is present
# we delete that array element. 1 at the end allows us to print the line from first file as is.
($1 FS $2 in a) { delete a[$1 FS $2] }1
# This action takes place at the very end. Whatever is left in our array we iterate through
# and print it. This can cause the output to appear in any order hence sort is needed.
END { for (l in a) print l }' f2 f1
出力:
$ head f*
==> f1 <==
a|blue|3
c|green|2
b|yellow|1
==> f2 <==
a|blue
c|green
b|yellow
d|purple
$ awk -F'|' '
NR==FNR { a[$0]; next }
($1 FS $2 in a) { delete a[$1 FS $2] }1
END { for (l in a) print l }' f2 f1
a|blue|3
c|green|2
b|yellow|1
d|purple