diff - Command-line tool to display the differences between two files, or each corresponding file in two directories.
23
votes
4answers
2k views
Result of diff two files with switched lines says missing the same line twice
I am trying to understand the linux diff command on two files whose lines are just permutation of each other but not able to grok the output that it generates. Consider the three commands below:
...
7
votes
3answers
464 views
Run a diff between local and remote file
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 another host, also accessible via ssh, without having to manually ...
1
vote
2answers
67 views
Possible to view two text files side by side (read only)?
In emacs, we can view two text files side by side.
Is it also possible to do so in some simpler/lighter applications such as less?
Only viewing, no editing.
2
votes
2answers
48 views
How can I compare two files based on the value of the first column?
I want to compare two files based on the value of their first column:
file1
aaa 23 3
bbb 56 6
ccc 45 2
file2
bbb m a
aaa a m
ccc m m
The output file should be:
aaa a m
bbb m a
ccc m m
...
2
votes
1answer
52 views
diff two directories for changes and format output to use for script
I currently try to monitor two directories and subdirectories for changes in files. The directories contain the same set of files, some of them are changed. So I thought I might use the diff command ...
3
votes
2answers
55 views
Comparing files in unix columnwise
I want to compare two files with same number of rows and columns with records in same order.
Just want to highlight the differences in the column values if any.
file A:
1,kolkata,19,ab
...
2
votes
1answer
26 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 ...
1
vote
1answer
29 views
Assign diff -y column names
I have two files and a shell script.
File 1:
Batman
Superman
John Snow
Jack Sparrow
Rob Stark
File 2:
Batman
Ironman
Superman
Spiderman
John Snow
Arya Stark
Jack Sparrow
Rob Stark
The hound
...
2
votes
3answers
331 views
Comparing text files using Bash and AWK
I have two text files, and I want to compare their corresponding values according to their rows and columns. By comparing, I mean to check if the values are equal and echo if the values are the same ...
3
votes
1answer
67 views
Compare two files strictly line-by-line, without insertions or deletions
I have two files that essentially contain a memory dumps in a hex format. At the moment I use diff to see if the files are different and where the differences are. However, this can be misleading when ...
0
votes
2answers
47 views
SSH using diff and still not working
I have 2 file, a.txt and b.txt and I want to compare them.
a.txt contains:
abc
jkl < jkl
mno > mno
pqr <> pqr
b.txt contains:
abc
jkl < jkl
mno > mno
pqr <> pqrs
stu
I'm ...
2
votes
0answers
37 views
One way diff between 2 directories
I am looking to perform a diff between 2 directories, both of which contain may files and subdirectories.
I am hoping to perform a one-way diff between a source and target directory that will return ...
2
votes
0answers
90 views
diff -r only for certain file types
Is there a way I can perform a recursive diff of two directories but only compare (in their respective places) files that match a specific filename or filetype predicate?
E.g. I would like to do ...
1
vote
0answers
47 views
How do I fix a patch [closed]
I am trying to fix a patch, and reviewed a couple of very interesting urls. One of which is this one: Handling Patch Rejects I like to make sure I am understanding the patch and the problem correctly. ...
4
votes
1answer
57 views
heuristically find how different a set of files are
I am having a large number of output files produced by repeated runs of a test suite and would like to see, approximately, how different they are. Ideally they should all be identical (indicating a ...
4
votes
1answer
53 views
Compare files and tell how similar they are
Is there a way to compare two file and give some kind of numeric indication of their similarity?
For example, if I have two files that differ by just one character (say, a character was deleted or ...
1
vote
0answers
50 views
Merge several files with maximum 1 line difference
Suppose I have the following files:
file0.c:
int b=NULL;
int a=NULL;
file1.c:
int b;
int a=NULL;
file2.c:
int b;
int a=NULL;
I am looking to merge the files file1 and file2 to generate the ...
4
votes
2answers
287 views
How to know if a text file is a subset of another
I am trying to find a way to predict if a text file is a subset of another..
For example:
foo
bar
is a subset of
foo
bar
pluto
While:
foo
pluto
and
foo
bar
are not one a subset of each ...
2
votes
3answers
595 views
Alternative to diff with progress for massive directory compare?
I just rsync-ed 2,000,000 files (3TB) from one RAID to another.
I want to make sure my data is intact.
rsync -c takes a really long time.
diff doesn't show me what it's doing.
Is there an ...
10
votes
2answers
317 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?
2
votes
2answers
37 views
Diff dpkg files with local copies
Is there a way of diffing the dpkg files with the one that are actually installed? Or barring that a way to find ones that have been modified?
1
vote
1answer
65 views
Running 'diff 'command after the 'find' command
I'm running this code on shell
mv -f ~/sites/text1.txt ~/sites/text2.txt;find ~/sites/ -type f -exec sha1sum {} >> ~/sites/text.txt \;diff ~/sites/text1.txt ~/sites/text2.txt;
However every ...
2
votes
2answers
51 views
How to show names of files being compared?
I used diff --from-file to compare my Riak dev1 config to the three others.
diff --from-file ~/riak/dev/dev1/etc/app.config \
~/riak/dev/dev2/etc/app.config \
~/riak/dev/dev3/etc/app.config \
...
5
votes
3answers
2k 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 ...
2
votes
1answer
103 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
37 views
rcs and graphical diff
I have a machine running Ubuntu 6.06. Source files under rcs (no git available).
I need to visually compoare older revs of files with the checked out version.
Until now I have moved the file and ...
2
votes
1answer
448 views
How to compare two tar archives (including file content, new/removed files, symlinks)?
I have two tar archives (compressed or not compressed), and I want to find all differences in the two archives. Both archives contain a complete file system (i.e. when unpacked, would generate ...
4
votes
1answer
163 views
Why does diff fail when invoked from a Makefile?
Narrow-down of a patch problem I am trying to troubleshoot:
Only two files, each with a size of 1 byte:
file a (containing 'a')
file b (containing 'b') and
Goal is to make and then apply a patch ...
0
votes
0answers
59 views
How to compare two rfs directories with `diff`?
I've two RFS (RFS = Root File System) directories, which I would like to compare to each other with diff. Both directories represent an RFS of some other system, and they may contain links. If those ...
2
votes
2answers
80 views
Hot to make diff check a symlink link itself?
In Linux one can use the command diff to check for differences of files. I use it to check for differences across two modules, both copied to /tmp.
However, both modules have symlinks, which might ...
1
vote
3answers
356 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
...
9
votes
5answers
278 views
Diff head of files
I have two files. One file, I suspect, is a subset of the other. Is there a way to diff the files to identify (in a succinct manner) where in the first file the second file fits?
3
votes
1answer
66 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 ...
3
votes
4answers
465 views
Can I get the opposite of `diff -q` — matching identical files without printing their contents
I have a number of files in a directory, and I want to check that they are all unique. For simplicity, let's say I have three files: foo.txt, bar.txt and baz.txt. If I run this loop, I will check them ...
3
votes
1answer
369 views
How to pipe diff into Kompare?
I want to quickly compare files in two different directories to see if the files are the same (same content). I want to see the results in Kompare (I'm on KDE - Kubuntu 12.04).
Here's my diff ...
1
vote
2answers
89 views
how to count number of differences in large streams quickly?
I want to count the number of differences (different bytes) in two large streams (devices/files). E.g. two hard disks, or one hard disk and /dev/zero.
The program(s) involved must be fast, as fast ...
2
votes
2answers
168 views
Understaning 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: ...
1
vote
1answer
164 views
RANCID like configuration differ for linux applications
I'm looking for a RANCID-like (http://www.shrubbery.net/rancid/) config management tool - the catch is that I want to manage config files for Linux applications like mysql, apache, memcache, varnish, ...
0
votes
1answer
26 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
215 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
1answer
144 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
52 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:
...
10
votes
2answers
1k 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 ...
6
votes
1answer
698 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
80 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
1k 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
146 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
401 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
863 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
145 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 ...