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??