(1) intersection of two files, and set
Prerequisites: No duplicate lines in each file
1. Remove the set of two files (duplicate lines are reserved only one copy)
Cat File1 File2 | Sort | Uniq > File3
2. Remove the intersection of two files (leaving only files that exist in two files)
Cat File1 File2 | Sort | uniq-d > File3
3. Delete the intersection and leave the other rows
Cat File1 File2 | Sort | Uniq-u > File3
(2) two files merged
A file on, a file in the next
Cat file1 file2 > File3
A file on the left, a file in the right
Paste File1 file2 > File3
(3) A file to remove duplicate rows
Sort file |uniq
Note: Repeated lines are recorded as one line, meaning that these duplicate rows are still in, but all are omitted as one line!
Sort file |uniq–u
The above command can remove all duplicate lines, that is, non-repeating lines in the file!
LINUX file merge, go to Heavy