diff - Command-line tool to display the differences between two files, or each corresponding file in two directories.

learn more… | top users | synonyms

0
votes
1answer
29 views

Read files in Directory and take diff

I have two directories named comp1 and comp2 and both have files named file1 and file2. I need a bash script which read file1 from both the directories and take diff of each file and redirect to some ...
2
votes
1answer
247 views

How can I see moved lines in a file comparison with vimdiff / diff?

Moved lines are frequently annotated as deletes and adds but they can be shown as moved-from and moved-to instead. Like in this screenshot of Notepad++.
2
votes
2answers
160 views

Getting diff (or git diff) to show inserted hunks properly

Let's say I have two files. The first one has the contents: line 1 foo line 2 line 1 bar line 2 And the second one has a new section inserted in the middle, so it looks like this: line 1 foo ...
0
votes
3answers
53 views

how to compare total file

Suppose i have 2 config files such as: file 1: smtpd_sasl_auth_enable = yes broken_sasl_auth_clients = yes smtpd_sasl_authenticated_header = yes virtual_gid_maps = static:5000 File 2: ...
11
votes
2answers
2k views

Is there a condensed side-by-side diff format?

I have two log files with thousands of lines. After pre-processing, only some lines differ. These remaining lines are either real differences, or shuffled groups of lines. Unified diffs allow me to ...
7
votes
1answer
980 views

Is there bdiff (1) in Linux?

There is bdiff(1) command in Solaris, which allow you to diff(1) files with size bigger than your RAM size (http://docs.oracle.com/cd/E19683-01/806-7612/files-23/index.html). Is there something like ...
3
votes
1answer
85 views

How-to diff distributions?

I am using a Raspberry Pi. There seem to be all kinds of linux distributions, all in .img Format that I use Win32DiskImager for to burn to SD-card. How do I find out, which files were changed(some ...
2
votes
2answers
2k views

How do I pipe colored diff output to less?

I've been using git diff, which produces colored output. However, I now find I need to use ordinary diff for something, and it's producing a lot of output that is hard to read because of the lack of ...
1
vote
2answers
185 views

What does -u of diff really do?

Looks like -u can take an extra number argument, but I don't quiet get the manual, It says, -u, -U NUM, --unified[=NUM] output NUM (default 3) lines of unified context Someone name an ...
2
votes
3answers
467 views

Diff 2 files ignoring strings between @ and [

I am comparing two files. I am trying to ignore the alphanumeric characters after @ and before [ . A line looks like model.Field@d6b0d6b[fieldName
6
votes
3answers
1k views

Get diff changes between original files installed with apt and current files

I installed php5-fpm package using apt; then I made some changes to the PHP configuration files. Now I would get the diffs between the original files versions (the ones of the package installed) and ...
2
votes
2answers
167 views

Live diff-mode editing in vim

I want a live view of diffs while I am editing a file. vimdiff is able to do something I want, like highlighting the differences between two files. However there are two drawbacks of vimdiff that ...
1
vote
1answer
143 views

Create a recursive diff directory. Copy reference and diff. Recreate original directory

I have several directories/web site resources, each has total size of several gigabytes. They are more than 90% the same. Sometimes only a few files are modified. I need to download these files for ...
1
vote
1answer
71 views

Interactive backup tool

I am looking for a backup (or diff) tool where I can select interactively which file I want to copy towards my external hard-disk. Let me explain with further details: I have two computers and an ...
6
votes
2answers
676 views

Same file, different filename due to encoding problem?

I was about to diff a backup from it's source to manually verify that the data is correct. Some chars, like åäö, is not shown correctly on the original data but as the clients (over samba) interpret ...
1
vote
2answers
113 views

How can I load the right hand pane of vim with a new file in linux?

I want to compare two files(say A and B) side by side(vertically) in in Vim. I open one of those two files(say A) and as per this answer in this site issue a Ctrl+w v . Now both the panels are showing ...
2
votes
0answers
163 views

Using Unison with colordiff

I want Unison to show the diffs with colordiff. I’ve got diff = colordiff -u CURRENT2 CURRENT1 | less -R in my config file but it seems like Unison pipes the output to plain less nonetheless, so I ...
1
vote
2answers
96 views

Reduce redundant logfile

I often have longer redundant log files, redundant in the sense that blocks of text repeat with minor changes. The length of the files makes it difficult to spot the actual information. I had the idea ...
4
votes
6answers
3k views

how to use patch and diff to merge two files

I have read about diff and patch but I can't figure out how to apply what I need. I guess its pretty simple, so to show my problem take these two files: a.xml <resources> <color ...
2
votes
2answers
120 views

Using Diff with -y to get side-by-side output

I am trying to use diff with -y to get side-by-side output, but my output gets messed up after about 18 lines. Here is an example, any clue why? (Check from *.java_pool_size=134217728) : ...
2
votes
2answers
84 views

How can I show the number of positions lines have moved in diff output?

top1 1,facebook.com 2,google.com 3,youtube.com 4,yahoo.com 5,wikipedia.org 6,baidu.com 7,live.com 8,amazon.com 9,qq.com 10,twitter.com top2 1,facebook.com 2,google.com 3,youtube.com 4,yahoo.com ...
2
votes
1answer
308 views

Compare all text files in a directory, and sort by similarity

In Unix, is there any way to compare every text file in a directory to every other text file in the directory, and then sort each pair of files by similarity (using the diff utility)? There are ...
2
votes
2answers
67 views

Keep patch in sync with changing source

Is there any standard option to create 'patch' P that works on file F in such way that it will keep working correctly when file F changes into F'. So I will either have some mechanism that will ...
1
vote
2answers
1k views

diff binary files of different sizes?

Is there a neat way to see the difference between two binary files? They are mostly the same, but some bytes are changed, and one of the files has sequences inserted in some places. Diffing the ...
2
votes
4answers
1k views

Check whether two directories and their subdirectories are the same

With diff -r I can do this task, however it takes so long because diff checks file's content. I want something that determine that two files are the same regarding of their size, last modified, etc. ...
7
votes
7answers
334 views

Review changes in .tex files

I have two files paper.tex and paper_suggested_changes.tex the latter is a modified version of the former with corrections. I need to go through the two files and choose which changes to accept or ...
3
votes
3answers
349 views

How to diff two folders by inodes

I'm currently using a script to backup files on my computer. In a nutshell, it works like this: rsync --link-dest=$FOLDER/current $SOURCE $DESTINATION However, I think that my script may be ...
7
votes
3answers
211 views

How do I compare a file with a floppy image and the actual floppy's content?

Is there a command that compares a floppy disk image (e.g. a .iso file) to the actual contents of the floppy the image was written on (e.g. /dev/fd0)?
3
votes
3answers
2k views

Diff, show modified line from right file only

I have file a and b and I would like to output lines of b that changed since it was cloned from a. Just the modified lines, no surrounding context, no diff offset marks. How can I do that using shell ...
2
votes
1answer
114 views

Is there a way to define the preferred merge or diff tool under Unix?

I know that you can define the preferred editor by setting the EDITOR environment variable. My question is if there is a similar solution for setting the preferred merge or diff tool.
3
votes
2answers
2k views

Difference of folders and files

I have two folders which have different folders inside. Those folders also contains different files. I am looking for the command that would give me the difference between those two parent folders. ...
4
votes
3answers
1k views

Get correct number of lines in diff output

I want to get the correct number of lines in the output of diff(specifically with -y and --suppress-common-lines options). Using a simple wc -l does not work, because if both files end without a ...
6
votes
3answers
4k views

How do I “merge” two text files?

I recently upgraded from Ubuntu 12.04 to 12.10 and at one point, it encountered an Apache config file conflict in apache2.conf. I didn't give me a merge option at that point, so I just rejected the ...
18
votes
1answer
6k views

What's the recommended way of copying changes with vimdiff?

When comparing files, and updating a source code repository, I like to use vimdiff. To copy changes made from one file to the other, I usually use a key sequence like this:- Shift + V (select line) k ...
5
votes
1answer
117 views

In Emacs, how do I inspect what has been modified in a buffer (before saving and overwriting the file)?

In Emacs, how do I inspect what has been modified in a buffer (before saving and overwriting the file)? (In a sense, the requested action is an analog of git status and git add -i showing what has ...
6
votes
3answers
8k views

Recursively compare two directories with diff -r without output on broken links

I am using diff -r a b to recursively compare directories a and b. It often happens though that there are some broken links (the same broken links in both a and b directories and to the same, ...
4
votes
3answers
176 views

Smart way to perform a similar replacement (not simple enough for diff) in multiple files?

I have a bunch of files (45, so too many to edit them manually without going crazy) which all require the same changes (as seen in the three diffs at the end of this question). Most tools used for ...
1
vote
2answers
2k views

How to make diff print a full file diff when a file does not exist?

I'm trying to compare files on the root file system with a backup, and I'd like the comparison to work a bit like git or svn diff when a file has been added or removed - That is, display the full file ...
-1
votes
1answer
4k views

Bash function to compare two binary files [closed]

I need a function to compare 2 binary files, here the requirements: 2 files, not 3 or 4 files can't be assumed to exist avoid running checksum (CRC/MD5/SHA/...) until one must if running multiple ...
3
votes
3answers
276 views

How to make and apply (patch) one side diff?

I want to make a shell script that updates a config file. The file present on the server has information, like various IP addresses. The new file has more code, from new configs added to the system, ...
8
votes
4answers
3k views

diff reports two files differ, although they are the same!

I have two files which look identical to me (including trailing whitespaces and newlines) but diff still says they differ. Even when I do a diff -y side by side comparison the lines look exactly the ...
12
votes
4answers
4k views

Converting colored output into html

There are tools providing coloured output: dwdiff -c File1 File2 # word level diff grep --color=always # we all know this guy ... The question is: How to convert their colored output of arbitrary ...
2
votes
1answer
274 views

password problem when feeding a remote file into diff

When I want to compare a local file with a remote file, any of these usually works: $ ssh remote cat file | diff file - $ diff file <(ssh remote cat file) However, sometimes (especially when the ...
3
votes
5answers
317 views

Kompare-like tool that needs no kdelibs dependencies?

Are there any Kompare-like tools without KDE dependencies? Can be Qt or GTK based.
3
votes
2answers
2k views

how to include a new file into a patch

I try to make a patch as introduced here. Say I have two directories pp1(modified version) and pp0(clean version), I make a patch file pp0.patch with the diff command: diff -crB pp0 pp1 > ...
7
votes
1answer
6k views

diff - output line-numbers

I want to use cli tool for file comparison and need line-number before output line with which help I could jump to line difference, because I use tool which understands where to jump, if the line ...
0
votes
1answer
103 views

Is there an application to find similar documents?

Is there any good software that finds groups of multiple files that are similar, or where one file includes a part of another? I have a directory with lots of files mixed up. Among the files, are ...
4
votes
4answers
4k views

Diff several files, true if all not equal

I have a number of files, I want to check that all those files have the same content. What command line could I use to check that? Usage could be something like: $ diffseveral file1 file2 file3 ...
1
vote
1answer
764 views

Diff command. Basic explanation

Just started with diff command. Can you please explain me, diff thin_provisionings_controller.rb thin_provisionings_controller.rb[211] 512,513d511 include ThinProvisioningsGraphModule So ...
0
votes
1answer
545 views

Directory diff in bash script

I have a bash script that expands two archives (jar files) into two directories and then does a diff of the two folders. I want the diff to be piped into a file so I do this in the bash file. diff -r ...