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

learn more… | top users | synonyms

4
votes
3answers
500 views

What does an exclamation mark mean in diff output?

I have an assignment for school. One part of it is to check a file for changes and write these changes to a log file. So far I've found the diff command which could be helpful in my opinion. Let's say ...
0
votes
2answers
25 views

Recursively compare root directory on Linux system A to root directory on Linux system B

I'm trying to diff all files on two Linux systems using rsync and ssh, by using the --dry-run option so it doesn't synchronize any files/folders. What am I doing wrong? I'm currently in the root ...
0
votes
1answer
66 views

Comparing files in awk/bash

I came across a problem and have no idea how to find the OPTIMAL solution. I have a list of files that looks like this: file1\0file2\0...fileX\0\0file(x+1)\0 Every name of file is separated by a \0 ...
1
vote
1answer
37 views

Evaluate differences between two files [closed]

Is there a way in Unix, to evaluate how similar or dissimilar, two text files are? I know about diff, but it just gives me the differences itself. What I am after is to just receive as an answer, ...
3
votes
2answers
46 views

“diff orig new” vs. “diff new orig”

When comparing 2 files using diff, the original file is provided as first argument, and the new (modified) as second argument. diff original new Presumably, the logic behind this ordering was to ...
3
votes
3answers
40 views

Identify common subdirectory names between two different directories and delete them

I have two dirs dir1 and dir2 that have hundreds of subdirectories at depth 1. I only need information of the subdirectory names that are common between dir1 and dir2 and systematically delete them ...
1
vote
1answer
25 views

Recursively compare directories with summary on different contents without examining file contents' differences

I want to compare the contents of two directories, recursively, showing which files are missing from one or the other, and which files have different content. But I don't want output on the ...
1
vote
1answer
25 views

Checking if the last diff command had output

I have some commands in a file that are like diff file1 file2 diff file3 file4 And if anything is output I want to print which command this happened in such as diff file1 file2 if (there was ...
3
votes
1answer
51 views

How to associate line number from a file to the side by side diff output result file?

My scenario is that: First generate side by side diff of two files using: diff -y --supress-common-lines file1.txt file2.txt > DiffResult.txt Output of DiffResult.txt: file1.txt ...
2
votes
1answer
49 views

How to find files with same name but different line count in two directories?

I have a directory sub1 with the following files: $ wc -l * 5 file1.csv 5 file3.csv 1 file4.csv In sub2, I have the following: $ wc -l * 5 file1.csv 5 file2.csv 1 file3.csv 5 file4.csv 1 file5.csv ...
1
vote
2answers
63 views

How to recursively side by side diff directories with line numbers in the diff in unix?

My scenario is to perform side by side diff directories using: diff -ry <folder1> <folder2> along with the line numbers in the diff output. By default line numbers are not displayed in ...
1
vote
1answer
43 views

Colored word-diff just like git's?

I've been for long using git's (colored) --word-diff which I find awesome. I found myself today in a situation where I had two strings I needed to compare word by word and craving for something just ...
2
votes
1answer
41 views

Ignore everything but text when comparing files with diff?

For the command diff, for file comparison, which options are required to for a file comparison where only the text is compared? What I mean is I want to ignore all spaces, tabs, newlines, etc. I've ...
0
votes
0answers
19 views

Compare two input and merge the difference

How can I compare two input strings and merge differences and get the result string like below with tools like diff? e.g. When I have two strings unix&linux stackoverflow unix&linux and ...
2
votes
1answer
61 views

How do I compare all files in dir to another file and print output of common lines

First I have a dir/ consisting of 100 .txt files john_1.txt, john_2.txt, john_3.txt, john_4.txt etc, that consists of ex. id;email;name;phone and then I have one other file emails.txt that consists ...
-1
votes
1answer
53 views

recursively compare the contents of 2 directories in CentOS 7

A build process in an app is generating a directory structure in a CentOS 7 machine. I have copied the app to a second location in the same server, made a few changes, and then run the build process ...
3
votes
2answers
163 views

Is rsync the fastest and most reliable way to verify whether directories are identical?

The problem is: I copied a 340 GB folder and I wanted to check if the copy was successful. The copy was made using rsync -aP /origin /dest from one ext4 partition to another ext4 partition. I know ...
-2
votes
2answers
57 views

Find ONLY the difference (extra) between two files in unix

I have 2 files. names1.txt and names2.txt. I need to know that which names are present in names1.txt but are missing in names2.txt. Then I need to store them in another file missing_names.txt. Diff ...
0
votes
1answer
58 views

How do I add to a unified patch file?

If I have a patch file in the unified patch format like the example below, how do I add lines to it so that those lines are then added by the (applied) patch? --- lao 2002-02-21 23:30:39.942229878 -...
7
votes
3answers
308 views

Side-by-side comparison of more than two files containing numerical values

I have three files containing a sorted sequence of numbers, one per line : file1 1 2 3 file2 1 3 4 file3 1 5 I want to "align" these three files side-by-side like the following : file1 file2 ...
2
votes
2answers
31 views

compare 1 column in 2 files and print the different line

I have file1 and file2. file1: a james b mike d john file2: a 10 20 30 40 b 11 12 13 14 c 20 30 40 50 d 10 20 30 50 I want the output file to only find the difference in column 1, and print that ...
3
votes
2answers
94 views

rsync claims different files, but diff does not?

I have a file both locally and on server. I first try running rsync in "dry-run" mode, to see if there are some differences between the files: $ rsync -aP --dry-run [email protected]:/home/dir . USER@...
1
vote
0answers
9 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
35 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 ...
4
votes
1answer
51 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
42 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 ...
2
votes
3answers
221 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
159 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
52 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 ...
1
vote
2answers
189 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
2answers
126 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 ...
2
votes
3answers
107 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, ...
0
votes
1answer
129 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 ...
1
vote
2answers
661 views

Diff: only compare if file exists, not contents [duplicate]

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 ...
1
vote
1answer
51 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 ...
0
votes
1answer
44 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
167 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
89 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
128 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
28 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
163 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
42 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
122 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
44 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
44 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
38 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
42 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 wildcard ...
0
votes
2answers
142 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 the ...
8
votes
2answers
79 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 ...
1
vote
2answers
280 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 ...