nkouevda / pdiff

Pretty side-by-side diff
https://pypi.org/project/pdiff/
MIT License
8 stars 1 forks source link

Supressing common lines #3

Closed sergeevabc closed 3 years ago

sergeevabc commented 4 years ago

Dear @nkouevda, Imagine there are two huge lists (hostnames, for example) which are almost identical. How could I find the difference with this tool? In the past diff --suppress-common-lines helped.

sergeevabc commented 4 years ago

A very slow Windows workaround:

findstr /V /G:animals-zoo1.txt animals-zoo2.txt
Amur leopard
nkouevda commented 4 years ago

You might want diff -U0 (or pdiff -U0)?

sergeevabc commented 4 years ago
$ pdiff -U0 --no-signs eff_large.wordlist eff_large.wordlist2
--- eff_large.wordlist                                        +++ eff_large.wordlist2
@@ -0,0 @@                                                    @@ +1,1 @@
                                                              abacus
@@ -2147,1 @@                                                 @@ +0,0 @@
eldercare
@@ -2820,1 @@                                                 @@ +0,0 @@
geek

Almost there. Some switch to supress @@-lines is missing, so sed comes to rescue as follows

$ pdiff -U0 --no-signs eff_large.wordlist eff_large.wordlist2 | sed /^@@/d
--- eff_large.wordlist                                        +++ eff_large.wordlist2
                                                              abacus
eldercare
geek