Actually i want to track the file1 and file2 for common records.
output file should get the records that are in file1 and not in file2. Here 4 aa's are there in file1. and 2 aa's are in file2. i jus want to get " 2 aa's in file1 and 4 aa's in file2. so we need to track this aa." like this message should come in the o/p file.
one more feature need to add to this command. example sometimes 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
awk 'NR==FNR{a[$0]++;next}
( a[$0] >= 2 ){b[$0]++}
END {
for ( i in b )
if ( b >= 1)
print i
}' file2 file1 > out
but 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