awk command

Iam having files as follows:

if case1
file1
aa
aa
aa
aa
ab
ac
ad
ae

file2
aa
aa
aa
aa
ab
ac
ad
ae

Outputfile:
should be empty

if case2
file1
aa
aa
aa
aa
ab
ac
ad
ae

file2
aa
aa
ab
ac
ad
ae

Outputfile:
aa

Note: if file2 contents matches with file1 no output should be created. if file2 has records more than once, it should check that records in the file1.

in the above example. file1 has aa 4 times.

file2 has aa 2 times. then i getting the output file corrcetly
using the command given

Code:
awk 'NR==FNR{a[$0]++;next}
( a[$0] >= 2 ){b[$0]++}
END {
for ( i in b )
if ( b [i]>= 1)
print i
}' file2 file1 > outbut if i am having the files as in case1. then i need to get the output file empty, but using this above command iam getting output as

aa

can i get the suggesions??

is this not just exactly the same question you asked in:

yes this is the same question... ihave created this new post to track the replies after i have changed the files.

Thanks

Tytalus is right. No duplicate threads are allowed. That is against the rules.

(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.

Closing this thread.