I have two text files, which are almost the same except for some changes on a few lines. I would like to merge these two files into a single text file, with differences highlighted, so that I can then view the merged file on an editor and manually review those differences.
This would be, I imagine, somewhat similar to what you typically get from an svn merge conflict. For example is file1 contains:
Top piece of bread
Mayonnaise
Lettuce
Tomato
Provolone
Salami
Mortadella
Prosciutto
Creole Mustard
Bottom piece of bread
And file2 contains:
Top piece of bread
Mayonnaise
Lettuce
Tomato
Provolone
Sauerkraut
Grilled Chicken
Creole Mustard
Bottom piece of bread
I would expect the merged file to contain something like:
Top piece of bread
Mayonnaise
Lettuce
Tomato
Provolone
<<<<<<< .file1
Salami
Mortadella
Prosciutto
=======
Sauerkraut
Grilled Chicken
>>>>>>> .file2
Creole Mustard
Bottom piece of bread
Maybe there is a diff option for this that I'm missing?
diff old new -D CHANGEDwould be good enough. While, to better match the output suggested on my own question, one would also need to supply--changed-group-formatas shown here. – Juan A. Navarro Mar 24 '14 at 13:57