LINUX file merge, go to Heavy

Source: Internet
Author: User

(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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.