I want to extract common number present in all file. I have 1000 file in folder. I Want to compare all file number and find out common number in 1000 file. I have used below code:
for ((i=2;i<=10000;i++))
do
comm -12 --nocheck-order a.txt "$i".txt > final.txt
mv final.txt file.txt
done
But it is only over writting and comparing only last file with a.txt. But I want common number present in all file.
let say a.txt file:
1
3
47
8
6
7
1.txt file :
2
3
6
7
8
2.txt file :
3
5
6
7
9
3.txt and 4.txt....1000.txt. If this works fine for this 3 file, It should work fine for all file. So common in this file is:
3
7
while it is giving me
3
8
3
Please let me know how I can proceed?