Are there any repeated materials?

Source: Internet
Author: User
Are there any duplicate file comparisons? Compare the data in each row of two txt files. for example, are there any duplicates in the 1.txt 8082748265422675328295754178501705919687846775125460539949 file?
Compare the rows of data in the two txt files.
For example:
1. txt

808274 826542267532
829575 417850170591
968784 677512546053
994943 395284907536
212236 485276124525

2. txt

010653 641973541583
976885 972087709626
980109 759921215816
649015 043755572655
031179 843814920390

As shown in the following figure, check whether the data in each row in "1.txt" and" 2.txt "is repeated first,
After that, are there any duplicates in the sum of 1.txt and 2.txt data?

------ Solution --------------------
The simplest way is to read both files into an array and then use array_diff

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: 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.