Finding common value across multiple files containing single column values

后端 未结 4 1211
温柔的废话
温柔的废话 2020-12-11 22:13

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
112         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 22:38

    Files with a single column?

    You can sort and compare this files, using shell:

    for f in file*.txt; do sort $f|uniq; done|sort|uniq -c -d
    

    Last -c is not necessary, it's need only if you want to count number of occurences.

提交回复
热议问题