input files file0 file1 1 2 2 4 3 5 5 8 7 9 9 logical test 1<=>2 -1 next 0, keep 1, print to nomatch0 2<=>2 0 next 0, next 1, print to match 3<=>4 -1 next 0, keep 1, print to nomatch0 5<=>4 1 keep 0, next 1, print to nomatch1 5<=>5 0 next 0, next 1, print to match 7<=>8 -1 next 0, keep 1, print to nomatch0 9<=>8 1 keep 0, next 1, print to nomatch1 9<=>9 0 next 0, next 1, print to match output files matched nomatch0 nomatch1 2 1 4 5 3 8 9 7