Linux-two file content intersection and union / a file remove b file content / find duplicate content

 

1. Intersection: Find out the duplicate content of A.txt and B.txt:
 cat A.txt B.txt |sort -n |uniq -d> same.txt

 

2、差集:A.txt 去掉 same.txt的内容:
 cat A.txt same.txt |sort -n |uniq -u > new.txt

 

3. Union: Summarize the contents of the two files

cat a.txt b.txt | sort -u > new.txt

 

Guess you like

Origin blog.csdn.net/helunqu2017/article/details/114386166