How to find common rows in multiple files using awk

前端 未结 2 1441
一向
一向 2021-01-29 02:29

I have tab delimited text files in which common rows between them are to be found based on columns 1 and 2 as key columns. Sample files:

file1.txt 

aba 0 0 
aba         


        
2条回答
  •  梦如初夏
    2021-01-29 03:00

    Can't you simply use uniq to search for repeated lines in you files?

    Something like:

    cat file1.txt file2.txt file3.txt | uniq -d
    

    For your complete scenario, you could use uniq -c to get the number of repetition for each line, and filter this with grep.

提交回复
热议问题