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

learn more… | top users | synonyms

2
votes
2answers
51 views

Using Diff on a specific column in a file

Will it be possible to use diff on a specific columns in a file? file1 Something 123 item1 Something 456 item2 Something 768 item3 Something 353 item4 file2 Another 123 stuff1 Another 193 ...
1
vote
3answers
39 views

check if all files from a folder are also in another folder

I basically have a directory a with lots of images. Now I want to check if all of these images are in directory b. The point is, that lots of images in b ain't directly in b but in subdirectories. ...
2
votes
1answer
19 views

`diff -y file-{a,b} | less` and DOS line endings display issues

In my current job I often have to work with files from Windows machines which most of the time isn't a big deal, but when piping a side-by-side diff to less, not only are the ^M being displayed, but ...
0
votes
1answer
56 views

Diff: slightly different filenames, same file

I'm using diff -rq to compare directories on a Mac OS X 10.6 server. In folder1, we have 'filename'. In folder2, we have'filename.archive' because folder2 is created by a file sync app that also ...
1
vote
1answer
48 views

How can I compare 2 files and add lines that aren't on the second file?

I have run into a problem while doing some coding, and I need to compare two files, here is an example input file inputfile1.txt: car php module so js node array and another input file: ...
1
vote
1answer
28 views

Compare directory trees regarding file name (and size and date)

I want to check the results of a restore from backup. This is, because TimeMachine on MacOS gives me some weird errors and warnings and I want to make sure, everything is in its place again after ...
1
vote
2answers
849 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 ...
4
votes
3answers
522 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 ...
1
vote
1answer
35 views

How to remove data that shows up from 'strings' on a file?

I've downloaded a video via a website that forces a login. Thus, it knows my login. If I run the following on it, I get results that I do not want to have: strings video.mp4 | grep "my user name" ...
0
votes
2answers
28 views

Tool for visual directory comparison

This question is not about visual diff -- i.e. file comparison. Is there a tool which let me compare directory A and B (recursively), and as the output I would get two panes, with lists -- files in A ...
2
votes
3answers
174 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
1answer
32 views

Different results OS X/Linux with “find PATH -mount \( -type f -o -type d \) -print0 | LC_ALL=C sort --zero-terminated > OUTPUT.txt”

this command is part of a script I use for comparing files: find test/ -mount \( -type f -o -type d \) -print0 \ | LC_ALL=C sort --zero-terminated > OUTPUT.txt // test/ is the PATH ...
0
votes
0answers
18 views

Configuration files difference between 2 dirs of the same app

I have an application installed on 2 machines I upgraded the first application on one server and want to copy the installation from this server to the other one but there is changes in some conf ...
3
votes
2answers
28 views

How to display which file differs from the others

I'm trying to write a script to get info from 5 different places and compare them for differences. The information is simply IP addresses and I have them placed in text files. I'm using: diff ...
0
votes
1answer
55 views

Is this a good way to create a patch?

I would like to create a patch from a specific gcc branch comparing it to the official releases; so when I unpack the tarball from the stable release, I can apply the patch and get the equivalent of ...
3
votes
2answers
166 views

How can I get difference ratio using “diff” or other command?

I have two files with thousands lines. I want to get their differences ratio in lines/bytes using diff, vimdiff or other commands, even regardless of the specific differences.
4
votes
3answers
3k 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 ...
3
votes
1answer
94 views

Identify duplicate blocks of text within a file

Is there a convenient way to identify duplicate or near duplicate blocks of text within a file? I want to use this for identifying code duplication. It looks like there are specialty programs with ...
9
votes
2answers
553 views

Tool in unix to subtract text files? [duplicate]

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
1answer
37 views

diff --horizon-lines=lines explained

I found both these quotes on the same diffoption --horizon-lines=lines: Do not discard the last lines lines of the common prefix and the first lines lines of the common suffix. [source] The ...
0
votes
2answers
50 views

check two partitions by selecting random files and running sha1 hashes on two files of each partition

A previous answer to a post mentions to run sha1 hashes on an images of a dd drive clone image. Another answer to that post suggests mounting the dd image an then compare if the sha1 hashes of ...
3
votes
1answer
75 views

How do I diff the outputs of two commands?

How can I use the diff command to compare 2 commands' outputs? Does something like this exist? diff ($cat /etc/passwd) ($cut -f2/etc/passwd)
0
votes
0answers
17 views

what does 1d0 mean in diff output? [duplicate]

Say you have two files file1 a b c d file 2 b c d e The first line of diff file1 file2 would be 1d0 I've read up on this and found that it means delete the lines in the first file at ...
0
votes
1answer
28 views

diff files within dirs listing by date modified

I was using MELD but it can't seem to sort by modification time, so I've been looking for a way to achieve something similar in terminal. I found a line of code find /path/to/dir1 /path/to/dir2 ...
7
votes
3answers
632 views

Git pager is less, but what is causing the output coloring?

less itself isn't capable of doing syntax highlighting, according to this thread. However, git diff nicely shows colored output in less, its default pager. When I redirect the output of git diff ...
3
votes
1answer
43 views

git diff of copies that only added lines

Say I have two processes that append lines to copies of the same original (parent) file (copy_A and copy_B). If I diff these copies, can diff ever conclude that we have a conflict? (i.e. can it ever ...
2
votes
3answers
104 views

Is cmp faster than diff -q?

In a recent AU 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 SO answer ...
2
votes
2answers
167 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 ...
6
votes
2answers
2k views

Comparing directories in Emacs

I am experimenting with ediff-directories, but I am not sure I am using it correctly. I read in the documentation that, once I supply two directories to ediff-directories, if I press == Emacs ...
19
votes
4answers
14k views

How to diff files ignoring comments (lines starting with #)?

I've two configuration files, the original from the package manager and a customized one modified by myself. I've added some comments to describe behavior. How can I run diff on the configuration ...
18
votes
7answers
22k views

Which GUI diff viewer would you recommend, with Copy-to-Left/Right functionality?

I've hardly ever used anything other than Meld. Can you recommend anything else? It would be extra nice if you give a reason for your recommendation (as a Comment). [note] I want an alternative ...
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 ...
25
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
804 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
107 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
81 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
171 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
133 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
47 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 ...
2
votes
3answers
2k 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 ...
1
vote
1answer
36 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 ...
6
votes
2answers
3k views

diff where lines are mostly the same but out of order?

I want to diff two sets of mod_rewrite rules. The set of lines are about 90% identical, but the order is so different that diff basically says they are completely different. How can I see which lines ...
3
votes
1answer
83 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
52 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
68 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
430 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
65 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. ...
6
votes
3answers
10k 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, ...
2
votes
1answer
134 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)
4
votes
1answer
62 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 ...