I have five files which contain some duplicate strings.
file1:
a
file2:
b
file3:
a
b
file4:
b
file5:
c
So i used awk 'NR==FNR{A[$0];next}$0 in A' file1 file2 file3 file4 file5
And it prints $ a
, but as you see there is b
string 3 times repeated in other files, but print only a
.
So how to get all repeated string (a
b
) from analysing/comparing every file with each other using one line command? Also how do I get the number of repeats for each element.
you can use one of these;
or
you could test this for a=3 and b=4.
test: