diff - Command-line tool to display the differences between two files, or each corresponding file in two directories.
0
votes
1answer
23 views
Is `git diff` related to `diff`?
Is git diff related to diff?
Is git diff implemented based on diff?
Is the command line syntax of git diff similar to that of diff? Does learning one help using the other much?
are their output ...
0
votes
1answer
22 views
Why is `-p1` to `patch` here?
For revert the changes to a file in a commit, from http://stackoverflow.com/a/2620822/156458
#!/bin/bash
function output_help {
echo "usage: git-revert-single-file <sha1> <file>"
}
...
4
votes
1answer
204 views
Process substitution in GNU Makefiles
On a bash prompt, one can execute diff using pseudo files:
diff <(echo test) <(echo test)
Adding this as is into a Makefile fails:
all:
diff <(echo test) <(echo test)
The error ...
3
votes
2answers
34 views
differentiating two files and getting the unique output in third one
I'm very new to shell scripting and learning it now.
I have two files.
File 1:
1 StartInstall, CDM_2.5B263, OK
2 EndInstall, CDM_2.5B263, SUCCESS
3 StartPatch, CDM_2.5.0.2B1, OK ...
0
votes
0answers
23 views
linux diff of all files in a folder added or modified within time range [duplicate]
In short, I would like to know a linux command which will list, recursively, all files in a folder (and subfolders) which have been either modified or added between a certain time period.
Similarly a ...
0
votes
2answers
22 views
colordiff - how to retain color while saving to file
Is it possible to retain the color while storing the diff output in a file?
This is working and showing the colors in terminal
colordiff -yW 1000 --suppress-common-lines file1 file2 > tempfile
...
0
votes
0answers
10 views
sdiff is not displaying the full line while comparing
I am comparing 2 files using the sdiff command and suppressing all the common lines. While the differences are printed its not showing the full line. Somewhere the length of the line is getting ...
-2
votes
0answers
22 views
Script to diff printer lpstat output
I am trying to create a script to diff lpstat command from one server to another based on a file with server list as input. I was able to list lpstat output, however I need to diff from server to ...
1
vote
2answers
54 views
how to use Diff command ignoring text with in a line and get unmatched data based on condition
I am trying to get the below output with the given input.
Can this be done with diff command? I am trying this syntax but not working:
diff -a --suppress-common-lines a.txt b.txt
Here are the two ...
2
votes
2answers
48 views
Script to compare to excel files and print differences
Is there any script handy to compare 2 excel sheets and print only their differences?
2
votes
2answers
70 views
diff two large CSV files (each 90GB) and output to another csv
This is a follow up question from Sort large CSV files (90GB), Disk quota exceeded.
So now I have two CSV files sorted, as file1.csv and file2.csv
each CSV file has 4 columns, e.g.
file 1:
ID Date ...
3
votes
1answer
34 views
Naive line-by-line comparison like “comm -3” but looking like “diff -y”
I am looking from something which gives me an output of comm -3 on two sorted outputs (line-by-line comparison, only additional/missing lines from either side) but which looks more like the output ...
1
vote
0answers
114 views
Use rsync to compare a remote directory with a local one, and store differences to another local directory
My problem is similar to the one described in this question. I want to compare a directory to another, and store the differences in a third one. The difference is that in my case the first directory ...
1
vote
0answers
11 views
Restoring Maildir emails from backup on different machine (so filename conventions differ)
I have GMail synced via IMAP using offlineimap on Machine A and Machine B. I accidentally deleted 5000 messages when trying to sync Machine B. Machine A was off at the time, and so I still have ...
1
vote
1answer
40 views
Saving diffs to two files for modified and new additions
I'm trying to compare a new file (e.g., new.txt) to an old file (e.g., old.txt) to see what was added in the new file. I'm trying to add the newly added information to a new file called newCourses.txt ...
0
votes
2answers
22 views
Is there a way to diff a line from different files?
I'm currently doing some consolidation of i18n files. In some cases I have duplicate keys across multiple files, and I want to figure out if I can remove one of the duplicates.
Here's an example:
...
2
votes
1answer
47 views
How to change the coloring scheme of Gdiff in vim-fugitive plugin?
I use the vim-fugitive plugin to check git diff. The coloring scheme to highlight the code changes does not compliment my solarized background. I am not able to see the commands to change the coloring ...
0
votes
2answers
56 views
Can linux command comm handle UTF-8 encoded text files?
I want to compare to UTF-8 encoded text file. Can Linux command diff and comm handle these encoding?
3
votes
0answers
47 views
Compare two directories, but only a part of file name
I have two directories with a lot of files.
In one directory there are files eg
file_0001
file_0002
... etc,
and in the other directory files are
text_0001_file
text_0002_file
... etc.
...
4
votes
2answers
64 views
How to view differences between the man pages for different versions of the same program?
Whenever I am upgrading one of my Linux boxes (i.e. installing the next version of my favorite distribution), upgrading the respective configuration files always has been very time consuming, because ...
0
votes
1answer
25 views
cmp or diff and then replace disk image
Supposing that I have two disk images (2TB) (one is copy of the other) and then I do changes in one. Surely I could use diff or cmp for see changes. Now I can apply the changes in the another.
...
0
votes
1answer
16 views
diff changes of disk image and restore in hdd
I guys, I have a diskimage.raw of all a hdd (/dev/sdd) 100gb.
I've read image with:
losetup /dev/loop0 diskimage.img
Then I've do a modifications (like add 8gb in files)
Could I restore the ...
1
vote
1answer
32 views
Compare two directiory excluding the files extensions
I have two directories: dir1 and dir2
In dir1 I have files like:
blacklist1.dat.bz2
blacklist2.dat.bz2
blacklist3.dat.bz2
and so on.
In dir2 I have encrypted files like:
blacklist1.dat.bz2.enc
I ...
1
vote
1answer
40 views
Diffing two directories recursively based on checksums?
I'm trying to find what files don't exist by a checksum of their content. I have two directories /foo and /bar, both of these directories represent arbitrary states on the system, I want to find all ...
-2
votes
1answer
109 views
Elegant way of diff'ing two variables?
I have $a and $b. I want to run diff on those.
The best I have come up with is:
diff <(cat <<<"$a") <(cat <<<"$b")
But I have the district feeling that I am missing a clever ...
1
vote
1answer
36 views
diff -B command is not symmetric?
This is the content of one.txt (REMARK: ignore the first line containing \\; I was unable to put blank lines at the start of code while writing the question. So the file starts from the second line, i....
4
votes
3answers
664 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
35 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
78 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
50 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
58 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
54 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
44 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
27 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
59 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
59 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
129 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
161 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
97 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
22 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
77 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
72 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 ...
4
votes
2answers
345 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
66 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
83 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
357 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
36 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
266 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
11 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
48 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 ...