I have 100 text files containing single columns each. The files are like:
file1.txt
10032
19873
18326
file2.txt
10032
19873
11254
file3.txt
15478
10032
11254
and so on. The size of each file is different. Kindly tell me how to find the numbers which are common in all these 100 files.
awk
to the rescue!
to find the common element in all files (assuming uniqueness within the same file)
awk '{a[$1]++} END{for(k in a) if(a[k]==ARGC-1) print k}' files
count all occurrences and print the values where count equals number of files.