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

learn more… | top users | synonyms

1
vote
0answers
6 views

Vimdiff copy above/below

do and dp are kinda limited to take one or another version of the conflict, in many cases it's just java imports when you need both changes, is there any way to make a map that copies the other side'...
2
votes
1answer
24 views

diff - showing changed lines in different section than inserted lines

(I'm running into this in a context of using vimdiff, which relies on and interprets the output of diff, so I think this is a diff question.) Given these files, the first having 2 lines, the second ...
9
votes
11answers
10k views

linux diff tools: create list of modified files

How do I create a list of modified files programmatically using linux command line tools? I'm not interested in the difference in any particular file (delta, patch). I just want to have a list of new ...
4
votes
1answer
31 views

Binary diff of two folders

Let's say I have two folders: before and after. ./before: bash ./after: bash The bash in the before folder differs from the bash in after. Using bsdiff or a similar program, is there a way to ...
2
votes
0answers
37 views

Why do two directories differ after syncing with rsync?

I copied some directories on one removable drive to another removable one using rsync. The command used was: rsync -avPS <source> <destination> rsync doesn't report any errors. After ...
4
votes
1answer
6k views

Can’t find file to patch at input line 3 [duplicate]

I generated a patch using the diff command with the number of context lines as 1 (-c option). My patch file contents: *** /home/sk/abc/def/src/klm/a.py 2015-05-18 16:25:50.348398554 +0530 --- /opt/...
2
votes
1answer
204 views

How can we compare two same directories in linux and list different files

Suppose I have same version of linux kernel but I changed some driver lines. Is there any way to compare these kernels and list the results. The result would be helpful to go back if I changed a lot ...
3
votes
2answers
43 views

How to get character level difference using “diff” command in Linux using shell script?

I have two SQL files, one is old.sql and the other one is new.sql. Suppose old.sql contains a table with three fields, Emp_Id, Name and Address and data stored in old.sql as follows: Insert into ...
1
vote
3answers
106 views

How can I compare different files without opening them?

I have two directories A and B; each one contains a lot of sub-directories geom001, geom002 ....etc each sub-directory contains a file named results. I want to compare, without opening any of them,...
0
votes
1answer
30 views

Use Diff to Exclude Quote Symbol - "

An Abnormal one. In simple i have two Source folders. Both have different code sets i want to compare. But there is one Symbol that will show multiple differences that i want to ignore. Its between ...
12
votes
4answers
10k views

Run a diff between local and remote files

I'm connected on a host via ssh and I'd like to compare (let's say with diff) a certain config file against its counterpart on an another host, also accessible via ssh, without having to manually ...
1
vote
2answers
82 views

Exclude PIDs when comparing strace output

I want to debug like: strace -fe open python /usr/bin/gnome-tweak-tool 2>>/tmp/hello.log strace -fe open python /usr/bin/gnome-tweak-tool 2>>/tmp/hello2.log Then use kdiff3 to compare ...
1
vote
2answers
45 views

Diff patch output saved to a file. How to see it syntax-colored?

I have a folder with subfolders that contains text files. Every now and then I run a script that makes a copy of that folder tree and then creates a new one with fresh info. After that, having the ...
1
vote
0answers
39 views

A patch that doesn't contain line numbers, is it possible?

I would add two lines of text to a file if they don't exist there yet. The lines can be in various positions in that file. So a regular patch will rather not work. Can there be a simplified patch, ...
11
votes
5answers
10k views

How do you compare two folders and copy the difference to a third folder?

You've got three folders: folder current, which contains your current files folder old, which contains an older version of the same files folder difference, which is just an empty folder How do ...
58
votes
1answer
20k 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
2answers
420 views

How to create a patch ignoring indentation differences in the code?

I'm trying to create patch a file using diff tool.But facing an issues.The way I am doing is below. I've created one Directory named a and put original file in to it. a/original_file.c Now I have ...
0
votes
1answer
21 views

Applying a single patch to files in multiple directories

Directory structures looks like this: orig/l1/l2/file2patch orig/l1-2/file2patch Diff'd with new/l1/l2/file2patch new/l1-2/file2patch I get the correct diff between these files and save it in a ...
3
votes
1answer
3k 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
93 views

Diff: only compare if file exists, not contents

I want to use Diff only to check if files and directories exist the same in two locations but NOT compare the contents of the files themselves, because that's all I need and a regular Diff just takes ...
10
votes
1answer
138 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 diff/...
27
votes
7answers
12k 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 ...
44
votes
8answers
22k views

diff within a line

I have some sql dumps that I am looking at the differences between. diff can obviously show me the difference between two lines, but I'm driving myself nuts trying to find which values in the long ...
3
votes
3answers
1k views

Is cmp faster than diff -q?

In a recent Ask Ubuntu question on checking whether some files have differing content, I saw a comment stating that, if the differing sections didn't matter, cmp would be faster than diff. This Stack ...
1
vote
1answer
43 views

Compare independent lines in two files [closed]

I have two files, each with 500k+ user accounts. I need to find the differences between the two (the missing accounts/delta). Each file is in a simple format, each line contains an email address in ...
18
votes
2answers
13k 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 ...
0
votes
1answer
31 views

How does the diff command handle caching?

I became curious when I was diffing two large (>326MB) files, and noticed that the second run took much less time than the first. This was frustrating, since I was trying to time the second run, to ...
-3
votes
4answers
100 views

Comparing 2 files

I have the need via a script to compare 2 files contents and if the contents are different then execute another script however is the contents are the same do nothing. I've tried using the DIFF ...
3
votes
1answer
47 views

How to upload a file and then check it and run some other commands using only ssh, cat, and diff in a single SSH session?

The goal is to change some parameters on a lot of devices on connections that are kind of unreliable (wireless)--according to csv that has the format: IP,Parameter,Parameter I would like to make a ...
1
vote
4answers
75 views

Silent result with two identical files in diff: how to show them?

When I set the -s parameter, diff also print files, that are different. diff -s $FIRST_FILE $SECOND_FILE
0
votes
0answers
17 views

gtksourceview complains about a missing style - but it's right there

I'm using the meld tool to view some source changes, in C++ and CUDA code. At some point I get the error message: (meld:19240): GtkSourceView-WARNING **: in file /usr/share/gtksourceview-3.0/language-...
1
vote
2answers
53 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 ...
9
votes
2answers
2k views

Tool in unix to subtract text files?

I have a large file composed of text fields separated by semicolons in the form of a large table. It has been sorted. I have a smaller file composed of the same text fields. At some point, someone ...
1
vote
3answers
36 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 ...
5
votes
2answers
88 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
22 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
34 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
35 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
41 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 ...
8
votes
2answers
71 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
12k 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
46 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
427 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
358 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
91 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
525 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, ...
6
votes
2answers
261 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> <path&...
4
votes
2answers
340 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
33 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
2answers
65 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 ...