Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [diff]

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

0
votes
1answer
24 views

Comparing IP info between two files based on criteria and outputting the results to two different files [duplicate]

I have a file called "knownIP". This file contain known IP addresses for a group of windows servers. These IP addresses are unique to this group of windows servers. I have another file called "...
0
votes
1answer
24 views

Diff outputs “binary files <file1> <file2> differ” but not the usual detail output

I would like to compare two files - "orienv" and "currenv", using the command diff. The way I had created the two files was as follow: Createing the "currenv" file $cat /proc/1/environ >> ...
5
votes
7answers
157 views

How to compare the same word between multiple files?

I would like to count the same words across multiple files then show in which file they are. File1: This is so beautiful File2: There are so beautiful File3: so beautiful The desired output 1: ...
0
votes
1answer
47 views

Comparing two files with an easy readable GUI program?

I would like to compare two large files that are not close to 1Gb in size. Kompare crashes when the files load is large. I configured Kompare as in the photo below: I would like to present the ...
1
vote
1answer
33 views

How alike/different are two binary files

I have some media files (right now it's video files, but I suspect I would also be able to use a good solution on picture files), that are very similar, but according to diff/cmp not identical. But if ...
1
vote
2answers
35 views

Comparing two separate directories for directories and files within

To compare the structure by iterating through each and every folder, I have tried to list the output(to a text file) of every directory and file present : diff --brief -Nr dir1/ dir2/ > out.txt ...
-2
votes
2answers
29 views

Filter the below text using shell commands

I am able to get the file difference using git diff command and I got it filtered like below: -This folder contains common database scripts. +This folder contains common database scripts. ...
1
vote
2answers
102 views

Side by side diff of large files

I have two ~1 GB files that I want to do a side by side diff of. Solutions I have tried: diff - Works quickly but doesn't output side-by-side. diff -y or sdiff - This outputs side-by-side but it ...
1
vote
1answer
26 views

Diff acting very strangely, reports long blocks as deleted when short bits throughout the block have been changed, deleted or added

Apologies for the title gore, I ca not think of a decent way to explain what is going on without a lot of words. I have two files, both are outputs from a code that I have put through cut to only ...
1
vote
1answer
32 views

How to find which lines are different in a CSV file in the Linux command line?

Im trying to find which lines differ in between file1.csv and file2.csv. if file1.csv looks like this: 1,2,3,4 5,6,7,8 9,10,11,12 and file2.csv looks like this: 1,2,3,4 9,9,9,9 5,6,7,8 9,9,11,12 ...
0
votes
1answer
28 views

Print only what is exclusive to a file compared to another in Bash

Good day everyone, I know there are a lot of similar questions already answered, but I can't find a satisfying answer and it drives me nuts. I have two files which both contain hostnames : one that ...
0
votes
1answer
78 views

Use diff and ls to detect files that changed in remote folder

I have a remote directory with read access. I want to generate a list of files that changed since last iteration. My idea is something like: $ cp output.new output.old $ ll > output.new $ diff ...
0
votes
4answers
28 views

Getting Mismatched Entries In 2 Files [closed]

Problem..{ I've users with home dirs in /home, so I can get a list of users matching my criteria with following command. STEP 1: Fetching A List Of Users du -h --max-depth=1 /home 2>/dev/null | ...
1
vote
1answer
227 views

Compare two zip files for differences

diff command compares to see any difference betwenn two files. Can the same be used to compare two zip files, i.e if there is any difference in data ,like counts etc in individual files in the zipped ...
1
vote
3answers
509 views

Linux equivalent of windows cmd command

I'm migrating to Linux, and I need to convert the following Windows cmd command: fc file1.txt file2.txt | find /i "no se han encontrado diferencias" > nul && set equal=yes I think fc can ...
0
votes
0answers
18 views

Software for directory integrity

I keep a directory on my home server with all of my important files on it. I want to make offline backups of this directory. But as I add and modify file, I also want to be able to make comparisons ...
0
votes
0answers
18 views

Simple multithreaded diffing on macOS

I run diff -rq on terabyte-size directories in macOS. Is there a simple way to parallelize this process?
0
votes
2answers
220 views

Show only changed lines without syntax with git diff

I have a list of usernames that are in a text file. I update this file and commit it. I am looking for a way to get a list of the changes since the last commit. I do not want any diff formatting at ...
1
vote
1answer
63 views

Allow patch of symlinks

When I try to run a patch command with a patchfile against a link, patch gives me the error: File path/to/file is not a regular file -- refusing to patch The following command produces this error ...
1
vote
1answer
25 views

Diffing for metadata differences

Is there are way to use utility like diff to find the difference in metadata of two identical file hierarchies? If I have two identical file structures like root_folder/ file1 file2 ...
1
vote
1answer
34 views

Getting differences of file between specific revisions/branches

I have 2 different branches A,B that have a (slightly different) version of a file X. I am interested in getting the commits that added some specific patterns in branch B. What I do roughly: diff ...
1
vote
1answer
82 views

How to undo after patch is applied? .rej/.orig files

The case is following. I have two files: file1.c, file2.c ls file1.c file2.c patch.diff patch < patch.diff ... x out of x hunk FAILED -- saving rejects to file file1.c.rej (the same with file2.c)...
2
votes
0answers
58 views

How to highlight output from diff command and make them side by side?

I have two files $ cat file1.txt UUXX:1 UUXX:2 $ cat file2.txt UUXX:3 UUXX:1 I want to use this command $ diff --old-group-format=$'\e[0;31m%<\e[0m' --new-group-format=$'\e[0;31m%>\e[0m' --...
1
vote
2answers
57 views

Find the difference between two list

I desire to compute the difference of two lists: $ pip list > package1.md Package Version ---------------------------------- --------- alabaster ...
0
votes
1answer
157 views

Apply patch to multiple different name

Is it possible to apply patch to different file name but with the same structure. The case was, I have a patch of a file with specific name and then for some inevitable reason that file got changed ...
0
votes
1answer
46 views

Change in shell script

I was using a bash script to do some automated testing on a CLI. All of a sudden it does not seem to work. Seems like our devops have done some changes to the OS. The error i see is bash-3.2$ sh ...
1
vote
0answers
56 views

Diff of PDF files leaves garbage on next command line [duplicate]

I would call this a curiosity more than a problem or anything else: When using diff on two specific PDF files that are similar but not the same, I get some garbage dumped on the next command line. ...
0
votes
2answers
72 views

How to write the difference between two files into a file

Saying that I have two files: a.txt and b.txt. The content of a.txt: hello world The content of b.txt: hello world something else Of course I can use vimdiff to check their difference, I can make ...
0
votes
2answers
39 views

Diff filenames of two directories?

So, I've run the ls -C1 on two directories: mod@ux:~$ ls -C1 /bin | wc -l 165 mod@ux:~$ ls -C1 /sbin | wc -l 167 How to list only different filenames/commands and which directory contains them?
2
votes
2answers
545 views

Diff between local and remote directory

I want to compare my local directory and remote directory. Example: Consider 2 directories as local and remote directory |-local | |--aaa | | |--file1 | | |--file2 | | | |--bbb | | |--...
2
votes
1answer
124 views

Using output of diff -e with sed

I'm currently attempting to change the contents of one file orig.sas to match the contents of an updated file new.sas Replacing orig.sas with new.sas makes some of the changes, but there are ...
0
votes
1answer
43 views

diff of config files showing only uncommented lines

Consider the need to use 'diff' to compare two files with many commented lines, such as system configuration files. (For example, the files could be /etc/cups/cups-files.conf.pacnew and /etc/cups/cups-...
0
votes
3answers
50 views

Trouble with piping

Why I can't do something like: tail -n 5 small.txt | diff small.txt I want to pass the execution result of the first command like second argument of the second, not stand alone input. How can I do ...
3
votes
2answers
827 views

diff - how to ignore empty lines

I need to diff two files ignoring all whitespaces and empty/whitespace lines but for some reasons diff options I found does not do all well, it keeps showing the empty line in file1... $ cat file1 2 ...
1
vote
2answers
49 views

How to get the modified files(before and after) from git version server?

Now here is the commit id 41f9f4e392ab50db264e0328de7d69f1f10646eb, I want to get this commit id code which were modified only. I use git show 41f9f4e392ab50db264e0328de7d69f1f10646eb to see modified ...
0
votes
0answers
58 views

diff where chunks of lines are out of order

So my question is related to : diff where lines are mostly the same but out of order? but is slightly different, in that in this case sorting won't work. I have 2 files and I want to do a diff ...
0
votes
1answer
119 views

Fuzzy diff n by n files

I want to know the individual difference between n files, so similar to this: parallel --tag 'diff {1} {2} | wc -l' ::: * ::: * A big problem here is binary files, and a single megalong line will ...
1
vote
2answers
136 views

Given two files, how do I find the total number of line changes?

I tried using this command to compute number of lines changed between two files: diff -U 0 file1 file2 | grep ^@ | wc -l My problem with this command is that if one file has only one line, and the ...
1
vote
1answer
52 views

Determine if two iso images are equal

I've recently made multiple images of several SD cards on multiple machines using dd. I haven't done a stellar job with my naming, and have some duplicates. How can I quickly determine if two images ...
2
votes
2answers
168 views

Does `patch` work with asymmetric context?

I have file a: This file does have an error in it that needs to be fixed. and a similar file b: This file does have no error in it that needs to be fixed. I can create a unified diff with diff -u ...
2
votes
1answer
98 views

Any Text File Merge Tools?

When I do version control on text (or latex) files I often run into the problem that the merge/diff tools are all line based while text files are not. This leads to insufficient granularity: every ...
1
vote
0answers
28 views

Counting only differenced disk usage

Is there a simple combination of commands that count the total size of files different between two directory structures? I am thinking somehow sending the output of diff to du, but am not proficient ...
3
votes
3answers
79 views

List files not having another file with suffix

Consider a directory with the following files: file1 file1.suffix file2 file3 file3.suffix I need to list all files such that there doesn't exist another file having the same name and a known suffix....
0
votes
0answers
86 views

How do I alter a large target binary file that is very similar to a source file - to match the source?

I tried to: rsync --inplace --itemize-changes -v -v -v -v --stats --progress /mnt/linux/sdb2.img.pristine ./sdb2.img but it takes a really long time - the image is 50G I also tried -no-W but ...
-7
votes
2answers
377 views

Comparing files and removing duplicates [closed]

I have two files, test1 and test2. I would like to compare the files and remove any entries in test2 that are already present in test1. Example: test1 [ostrich@post-om1 test]$ cat test1|head ...
-2
votes
1answer
417 views

Linux grep what in file 1 is in file 2 [duplicate]

File 1: 1234567890123456,00,00,000 1111111111111111,11,11,1111 File 2 1111111111111111,11,11,1111 9999999999999999,99,99,999 So i want to know what in file 1 is in file 2 which is Output: ...
5
votes
2answers
301 views

git: use visual diff (meld) only when in GUI

I know I can specify external diff command to be used for git diff: [diff] external = But then when I am logged in console (without X) this fails because my visual diff cannot open display (...
0
votes
1answer
258 views

How to diff files ignoring specific words?

I have two Files test1: [BEFORE_TEST] WARN: message1 [BEFORE_TEST] NOTICE: message test2: [AFTER_TEST] PASS: message1 [AFTER_TEST] NOTICE: message test2 is the fixes that i made based on test1,...
3
votes
0answers
239 views

Do rsync --checksum and diff usually have different outputs or is my hdd broken?

I set up a NanoPi Neo 2 with OpenMediaVault (Debian Jessie) as its OS and have an hdd attached to it (the OS is on an SD card). When I now copy my data from my external hard drive onto my system with ...
0
votes
1answer
88 views

Any way to change the tab size of the diff command's output?

I'm on OSX and running a diff command like this, to create side-by-side output: $] diff -Bbwy --width=200 --suppress-common-lines file1.txt file2.txt > diff-output.txt It outputs my diffs just ...