When I tried zozoo's script, it didn't come close to producing the requested output. (It is grepping for matching words instead of matching lines.) I think the following comes closer to what was requested:
awk '
FNR == NR {
if(NR > 1) f1[$0]
next
}
!($0 in f1) {
print
}' file1 file2 > file3
If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk .
Hi zozoo,
If we make some assumptions about the input that the original poster did not specify, then it might be possible to write a while read loop using grep to get the output specified in the 1st message in this thread, but I don't think it is as easy as you're implying.
Can you show us a while loop using grep that produces the output requested in the 1st message in this thread from the two input files shown in that message?