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
13 views

Color output of linux command similar to 'watch -d' to highlight differences?

I'm at the beginning of shell scripting etc. and a bit challenged to find the proper way of colorzing a command's repeating output, similar to the -d option in the watch command. I want to see the ...
1
vote
3answers
30 views

diff without including removed content

I'm using diff and patch to patch some files. In my situation, I am not permitted to distribute any of the original file. Right now, the diffs look something like this: 1c1 < Hello, this is the ...
4
votes
2answers
60 views

Search directories for multi line string

Looking for a way to recursively search a repository for all files containing a multi line string and return the file names that contain it. The paragraph is just a header approx 30 lines. So I know ...
0
votes
1answer
11 views

diffing two version of software,and do the interdiff

I have got some kind of software in version 1.2.0 (lets call it 120), my colleagues made changes in this software (they created custom module for this software by changing source code of software) ...
0
votes
2answers
28 views

Patching diff-files

I've downloaded a tarballed version of 0.85 "MTR" -> http://www.bitwizard.nl/mtr/ and installed it. I later saw that a 0.86 diff file exists. I downloaded this in order to patch it, but am confused ...
5
votes
2answers
28 views

diff consuming huge amount of memory and cpu

I have two files, all.txt (525,953,272 records) and subset.txt (525,298,281 records). Each record is nothing but a 17-digit ASCII integer. Both files have been sorted, and duplicate records within ...
0
votes
1answer
38 views

Compare a certain lines from multiple documents

I want to compare a certain lines in a multiple documents. I tried using diff and comm, but the conditions are these, the documents are in a different working directory/folder, I could use a ...
7
votes
2answers
57 views

diff characterwise

Is there a stable tool (option/plugin of an existing tool: vimdiff, diff, etc) in Linux to do diff between two text files characterwise? I would like to see the longest common subsequence between my ...
7
votes
4answers
8k views

Understanding of diff output

I have file1.txt this is the original text line2 line3 line4 happy hacking ! and file2.txt this is the original text line2 line4 happy hacking ! GNU is not UNIX if I do: ...
0
votes
2answers
26 views

What do the numbers in the “@@” line mean in output of diff? [duplicate]

Here is an example of Unix Shell program diff, from Version Control with Git, by Loeliger, 2ed: Let’s look at the diff in detail. In the header, the original file is denoted by - - - and ...
8
votes
4answers
368 views

Compare two URL lists and print newly added URLs to a new file

I am initially producing two files which contain lists of URLs—I will refer to them as old and new. I would like to compare the two files and if there are any URLs in the new file which are not in the ...
4
votes
3answers
345 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, ...
1
vote
2answers
37 views

Packaging a directory and its contents as a diff patch?

I have a small project folder with text files, which I'd like to post somewhere in order to ask a question on a forum. Let's take, in the simplest case, that I have something like this: mkdir aaa cd ...
12
votes
3answers
462 views

diff reports the same line as different in 2 files

I have 2 files containing a list of songs. hdsongs.txt and sdsongs.txt I wrote a simple script to list all songs and output to text files, to then run a diff against. It works fine for the most part, ...
5
votes
2answers
189 views

What is causing `diff` to run `git diff`?

I'd like to use diff as described here and in the documentation I see when I type man diff. However, when I type diff, what I get is this: ~ ❯❯❯ diff usage: git diff --no-index <path> ...
51
votes
1answer
16k 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 ...
2
votes
2answers
303 views

How to determine if file is just a permutation of another one?

Consider for example a source code file, where the functions are drastically shuffled around. Is there is a command to check if the reordering of lines is the only change? (that means no lines are ...
2
votes
1answer
25 views

Compare two files, while overriding second file's size

I am trying to verify a backup that I made using the following command: dd if=/dev/sda of=/dev/sdc2 I backed up the contents of /dev/sda (internal hard drive) to /dev/sdc2 (external backup drive, ...
1
vote
1answer
523 views

How to fix “Hunk #1 FAILED at 1 (different line endings)” message?

I am trying to create a patch with the command git diff sourcefile >/var/lib/laymab/overlay/category/ebuild/files/thepatch.patch when I apply the patch, it gives me $ patch -v GNU patch 2.7.5 ...
1
vote
2answers
45 views

Find values in a file from another file

I know, the title is not clear. I have 2 files, in one of this I have some values and I need to find them in another file. Instead to grep for each single value, I would use the first file to do ...
2
votes
2answers
63 views

How can I check if a directory contains the same files of a TAR archive?

Let's say I have a folder Documents and a TAR file Documents.tar, how to check if the tar file contains the same files that are present in the directory? The more obvious solution to me would be to ...
1
vote
1answer
29 views

Diff command with file type exceptions

While comparing 2 fairly big directories using diff -rq .... I want to exclude certain file types like 'tar.gz' or 'error_log'. How do I do that?
9
votes
3answers
7k 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 ...
0
votes
2answers
842 views

Color diff output

I am new to unix I wanted to format the Unix files conditionally, I am currently working on diff command and wanted to know if it is possible to format the text of the diff command output. Example: ...
1
vote
3answers
62 views

Compare two file contents horizontally and vertically

I have two files: File1 has the below contents: 1 2 3 4 5 6 7 8 10 File2 has the below contents: 1 2 3 4 5 6 7 8 9 10 How can I find the difference between two files and print the odd number ...
2
votes
2answers
96 views

Was 'diff' included in the first version of Linux

What is the list of programs that were available in the first public version of Linux distribution (not just kernel)? I am specially concerned when this distribution was released and if diff utility ...
2
votes
2answers
31 views

git --diff like command for Linux local dirs

dir1 has 1 file and dir2 has 2 files as below: /tmp$ ls dir1 file1 /tmp$ cat dir1/file1 line1 line2 line3 /tmp$ ls dir2 file1 file2 /tmp$ cat dir2/file1 line1 /tmp$ cat dir2/file2 line1 /tmp$ diff ...
2
votes
2answers
219 views

How to compare two directories thoroughly without git?

Here thoroughly means “list all differ files, find those files with same name and different content, list the difference of content”. Before I got a lazy solution, git init one directory and copy ...
6
votes
3answers
3k 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 ...
1
vote
3answers
233 views

How to pipe output of find as input for diff?

This is a basic question regarding bash but I could not find a solution. I have many subdirectories with identically named files and I want to compare all of them for identity. I can return list of ...
6
votes
2answers
5k views

What does 'patch unexpectedly ends in middle of line' mean?

This is the output of my patch command: Hunk #11 merged at 4184,4190. Hunk #12 merged at 4444. Hunk #13 merged at 4944. Hunk #14 NOT MERGED at 5106-5116. Hunk #15 merged at 5290. Hunk #16 merged at ...
2
votes
1answer
95 views

How to apply simple patch (reverse detected)

I'm trying to create and apply a simple patch to fix a bug with gradle. I copy the file (/usr/bin/gradle) to my working directory, then make the change. I then create the patch: diff -u ...
3
votes
3answers
384 views

Track daily directory changes (and email them)

I have a Debian powered NAS server (ReadyNAS) with a deep file hierarchy. I'd like to get notified daily about what has changed in some of its directories and their subdirectories. So if someone ...
2
votes
2answers
169 views

Applying a diff patch

I've never patched anything in Linux, and I can't exactly figure out what the guy who wrote this post (second paragraph) means. That target source is qemu from github and the changes to apply are: ...
2
votes
3answers
2k views

compare files line by line and create new one bash programming

I have two text files. File 2 has logs over 1,000,000. File 1 has IP addresses line by line. I want to read file 2 lines and search these lines in file 1, I mean: file 1: 34.123.21.32 45.231.43.21 ...
6
votes
4answers
1k views

Compare an old file and new file, but ignore lines which only exist in new file?

I have two files: oldlist - This contains a list of files and a md5 hash for each file. This was generated one year ago. newlist - This also contains a list of files and a md5 hash for each file. ...
1
vote
2answers
99 views

Comparing directories using diff

I'm trying to compare two directories that contain binary files, on AIX 6. I'm using diff in preference to dircmp, as I'm trying to maintain a consistent output format between this and my Linux ...
6
votes
3answers
2k views

diff a gzipped tarball against a directory?

Is there a way I can diff a gzipped tarball against an existing directory? I would like to be able to do it without extracting the data from the tarball.
3
votes
3answers
75 views

Rebuild original file from diff files to save disk space

Every day 10GB text file is downloaded, the file is ~200 million lines and ~1% of the lines are changed the next day. I want to keep daily files as backup, but I'm trying to save disk space by using ...
17
votes
5answers
1k views

Why use diff/patch when it is easier to just use cp

diff -u file1.txt file2.txt > patchfile creates a patch file which consists of instruction for patch to convert file1.txt to be exactly like file2.txt As the title says, Can't this be done using ...
2
votes
3answers
177 views

Difference between files in directory

I have two directories with same files but with some difference in their contents. I want to list down those files which are differing. For example There are two folders Folder1 and Folder2 with ...
11
votes
3answers
26k 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
1answer
156 views

Pass BASH array to diff like file contents

I have two bash arrays, say: arr1=( 1 2 3 ) arr2=( 1 2 A ) and I want to compare them using diff. How could I pass the arrays as if they were the contents of a file? I tried a few variations, but ...
2
votes
2answers
156 views

Find differences in file and sorting file by key

So I have two language files, english and french. They are in this format: key=translation An example in English would be: ui.title=My Title And in French: ui.title=Mon Titre So I need a ...
11
votes
3answers
852 views

Is there a Linux deep diff tool that also compares file attributes?

Is there a Linux tool like diff that will recursively compare files and directories, but with the addition of also comparing: extended attributes, acl's, se contexts?
-1
votes
3answers
144 views

Difference between two files

I have two files , say a & b. I want to compare both the files and get the differences in the third file along with the file name. Can anyone help me out with a simple command.
0
votes
1answer
261 views

blessdiff for the “full featured hexadecimal editor”?

I am trying to find some hex diftool which allows me to compare to documents in the view but also the internal differences like in bless so two bless windows side-by-side but with diff capability ...
2
votes
2answers
326 views

diff --git unknown option

when I try to run diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c I get unknown option (I have installed git via apt-get install git)
0
votes
1answer
109 views

how to pipe output from git commands into unix diff utility?

I am trying to achieve something along the lines of diff -ywB --suppress-common-lines `git branch --merged prod-server` `git branch --merged test-server` so that I can know the difference of what ...
5
votes
0answers
75 views

Display only relevant hunks of a diff/patch based on a regexp

git log -G<regex> -p is a wonderful tool to search a codebase's history for changes that match the specified pattern. However, it can be overwhelming to locate the relevant hunk in the ...