32
votes
Accepted
How to write the difference between two files into a file
comm -1 -3 a.txt b.txt > c.txt
The -1 excludes lines that are only in a.txt, and the -3 excludes lines that are in both. Thus only the lines exclusively in b.txt are output (see man comm or comm --...
6
votes
How to write the difference between two files into a file
If you dont care for subset, you can use just
diff a.txt b.txt|grep ">"|cut -c 3- > foo.txt
.
$ cat a.txt
hello world
$ cat b.txt
hello world
something else
$ diff a.txt b.txt|grep ">"|cut ...
2
votes
Display git-diff between master and my last commit
Don't be such a trusting person. ;-)
Sorry, sorry. Speaking more seriously -- the moment just before you merge is the perfect time to inspect what's changed between your work and your peers'. If you ...
2
votes
Accepted
Display git-diff between master and my last commit
This is not a very 'git like' way to approach the problem. Normally you would just keep a branch which pointed to your last commit.
However to answer the question, try the following helper function. ...
1
vote
Accepted
is vimdiff able to swap delta between open files?
Sure. Make a split (:split), make sure your two things are in the two different visible buffers, and run :windo diffthis.
You can still edit the buffers as normal, so, copying and pasting between them ...
1
vote
How can I make the vimdiff command use the same Vim version as the vi and vim commands?
You've aliased vi and vim to the one in /home/me/vim-dist/bin; presumably you'd also be fine just aliasing vimdiff as well.
For vimdiff to work properly it needs to be executed as "vimdiff" ...
1
vote
How to write the difference between two files into a file
Limitation: this is not a real file diff, more like a set of the lines diff (but you may need exactly this).
All differences between a.txt and b.txt:
sort a.txt b.txt | uniq -u > c.txt
Lines which ...
1
vote
How to disable vimplugins while invoking vimdiff command
You could use this syntax, in your .vimrc:
if !(&diff)
Plugin 'scrooloose/nerdtree'
endif
1
vote
Identify duplicate blocks of text within a file
This tool may prove useful: PMD’s Copy/Paste Detector (CPD).
I mainly use it in automated build tasks, but you should be able to run it separately from the command line, and give it a list of files or ...
Only top scored, non community-wiki answers of a minimum length are eligible