how to show lines in common (reverse diff)?

前端 未结 7 936
花落未央
花落未央 2020-11-27 10:35

I have a series of text files for which I\'d like to know the lines in common rather than the lines which are different between them. Command line unix or windows is fine.

相关标签:
7条回答
  • 2020-11-27 11:03

    In Windows you can use a Powershell Script with CompareObject

    compare-object -IncludeEqual -ExcludeDifferent -PassThru (get-content A.txt) (get-content B.txt)> MATCHING.txt | Out-Null #Find Matching Lines
    

    CompareObject:

    • IncludeEqual without -ExcludeDifferent : Everything
    • ExcludeDifferent without -InclueEqual : Nothing
    0 讨论(0)
提交回复
热议问题