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.

1
vote
1answer
58 views

Linux diff command, is it discarding newlines?

Does the Linux implementation if diff -w discard \n? I don't have access to a Linux machine to check that out.
1
vote
2answers
55 views

Diff between two csv files based on the column

I have two files file1.csv and file2.csv. Below are the contents of file1.csv AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb AR.jar;9a553dd203d0979aa60004e19cc98c12 BI.jar;8022f6c5f83ba040394ff0b0a0323e8e ...
-1
votes
1answer
35 views

Linux Compare two files on different field and print field 1 of first file

I have two files like this. file 1 1:apple 2:banana 3:pineapple 4:guava 5:orange and file 2 like this apple guava orange i just want to compare file 2 with file 1 and print the 1st field for the ...
0
votes
2answers
34 views

How do I diff the output of these two commands? [duplicate]

I have an alias which I use to strip out comments that are piped to it: alias decomment='egrep -v "(^#.*|^$)"' I'm currently having some difficulty with a squid proxy setup, so I want to compare ...
1
vote
1answer
51 views

Multi-threading diff

I'm comparing the content of two directories using the diff command in bash. It uses only one thread on a multi-thread system. Does somebody knows a way to have diff to use more than one cpu/thread? ...
-1
votes
1answer
53 views

Find unique lines, ignoring certain columns

I want to be able to go through a file and find lines that are different in the fields I expect to be stable, ignoring differences in the fields I know will be different. I want to ignore columns 2,5,...
1
vote
1answer
39 views

How to see which files are identical given a list of files in two projects

I have two projects named project1 and project2 with identical file trees as follows. project1/, project2/ . ├── src │ ├── index.html │ ├── main.js │ ├── normalize.js │ ├── routes │ │ ├──...
1
vote
0answers
28 views

How shall I understand the different outputs by `-A` and by `-e` of diff3?

diffutils' manual says, in diff3 -A mine older yours The ‘--show-all’ (‘-A’) option acts like the ‘-e’ option, except that it brackets conflicts, and it outputs all changes from older to yours, not ...
-2
votes
1answer
69 views

How does `diff` decide whether a difference is change (i.e. replacement) or combination of addition and deletion?

I was wondering how diff decides whether a difference is change (i.e. replacement) or combination of addition and deletion? The best I can find from diffutils' manual is ‘fct’ Replace the ...
0
votes
2answers
34 views

How shall I understand the conditions for merging by diff3 to be well-defined?

In diffutils' manual diff3 mine older yours You can remember the order of the arguments by noting that they are in alphabetical order. You can think of this as subtracting older from ...
-3
votes
2answers
81 views

What do comm and diff try to accomplish at input/output level?

Given two files, for each line in each file, how do comm and diff determine whether the line also occur in the other file? if it does, whether its occurrences in the two files are the same or ...
0
votes
1answer
89 views

How shall I understand the unified format of diff output?

From diffutils' manual Next come one or more hunks of diff erences; each hunk shows one area where the files differ. Unified format hunks look like this: @@ from-file-line-numbers to-file-line-...
0
votes
2answers
364 views

Is there some tool for finding files in one directory but not in the other? [duplicate]

I would like to write a bash script to find those files in a directory but not in another directory. Does the following script work? When does it not? for i in "$1"/*; do f=$(basename $i); ...
0
votes
1answer
38 views

Can someone explain to me what this **diff** means..? [duplicate]

I'm having an extremely hard time to read this can someone explain what it means, and what the difference between the two is ? $> diff -U 3 user_output_test1 test1.output | cat -e --- ...
1
vote
3answers
76 views

How to ignore differences between negative signs of numbers in the diff command?

I have two large files consisting mainly of numbers in matrix form, and I'd like to use diff (or similar command) to compare these files and determine which numbers are different. Unfortunately, ...
22
votes
1answer
915 views

What effect does the “-d” option have with diff?

The diff implementation on OpenBSD has a non-standard -d option with the following documentation: -d Try very hard to produce a diff as small as possible. This may consume a ...
3
votes
2answers
176 views

How to produce a diff without lone identical lines

Let's say I have rewritten a C function from scratch. It often happens that some lines happen to be identical before and after, in particular blank lines and closing braces. When I create a unified ...
0
votes
1answer
27 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
108 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 >> ...
4
votes
7answers
188 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
57 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
41 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
37 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
32 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. ...
2
votes
2answers
439 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

I have two files, both are outputs from a code that I have put through cut to only look at the first 26 characters of each line. Both files are lists of parameters that the code measured, such as "...
1
vote
1answer
116 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
32 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
175 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
32 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
1k 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
871 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
21 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
558 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
183 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
62 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
37 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
173 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
81 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
69 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
334 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
48 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
60 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
520 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
45 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
932 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
287 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
60 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 ...