B
B
bx-coder2017-06-20 15:09:35
linux
bx-coder, 2017-06-20 15:09:35

How to save diff of two text files to third file?

Let's say there are 2 identical CSV files with some upload (file1.csv and file2.csv). For example, a couple of lines have been added or changed to file2.csv. Is it possible somehow using the diff command (or else how) to compare these 2 files and the lines that differ, save them in a separate file. By default, diff stores the result in spec. format (arrows, separators), but in fact you need to simply save the different lines.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2017-06-20
@bx-coder

diff --changed-group-format="%>" --unchanged-group-format="" file1.csv file2.csv > newlines.csv

The first parameter is to display different lines from the second file, the second is not to display identical ones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question