Questions tagged [diff]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

How to compare two directories recursively, without dereferencing the symlinks, and listing only the names of the files that differ?

How to compare two directories recursively, without dereferencing the symbolic links, and listing only the names of the files that differ? So far, my best guess was the definition alias diffrqnd='diff ...
AlMa1r's user avatar
  • 125
0 votes
1 answer
31 views

How to prevent `diff -rq` from showing newly created files, when comparing the different versions of a folder?

I am doing diff -rq to check the difference between 2 folders (A and B). I don't want to know if folder A has any new files because that's expected. How do I ensure that this information doesn't come ...
desert_ranger's user avatar
0 votes
1 answer
45 views

How can I call git's built-in diff command directly after configuring a different visual "git diff" substitute?

I have configured git diff to be a command that calls substitute diff for viewing file differences i.e /usr/bin/vim -dR "$2" "$3" and that doesn't work when I want to create a ...
vfclists's user avatar
  • 7,531
0 votes
1 answer
60 views

Performing character-level comparison of "strings" without explicitly creating temporary files for git diff

Referring to this https://stackoverflow.com/a/31356602, I wrote this code: #!/bin/bash # Define the two strings to compare string1="First string with some random text." string2="Second ...
Gabriele's user avatar
  • 323
0 votes
2 answers
41 views

Fast file comparison that displays results side by side with structure understanding (a la total commander in windows)

Is there a way/tool to show differences between two files side by side only highlighting differences in a similar way kdiff3 does that but with a tool that is reasonably fast?A similar question was ...
atapaka's user avatar
  • 541
1 vote
1 answer
81 views

How to use kdiff3 to edit when comparing two files

I'm used to meld for editing while seeing an intra-line diff that's updated live in response to edits. One just types in the left or right pane of the window and then save one or both files. I'm ...
Croad Langshan's user avatar
1 vote
0 answers
27 views

When should I use comm over diff?

It seems diff can do anything comm can do? When should I use comm only but not diff excepting the difference in result format? I guess comm is faster?
tom10271's user avatar
  • 111
2 votes
3 answers
200 views

How to compare two directories recursively, and for each pair of files with the same name, location, and contents, say which file is older?

In a Linux shell, how to compare two directories recursively, and for each pair of files (including symlinks and directories) with the same location (including the name) in the two directories and the ...
AlMa1r's user avatar
  • 125
0 votes
0 answers
34 views

Yocto, bitbake - how to remove unwanted hunks in the patch file

I am trying to bitbake system for seedStudio odyssey board. I got into problems applying patches CmdError('quilt --quiltrc /home/seed-studio/STM/Distribution-Package/build-openstlinuxweston-stm32mp1/...
gulpr's user avatar
  • 109
0 votes
1 answer
225 views

How to compare minimised JS files with very long lines? diff prints whole lines which is unreadable (400k characters per line)

I need to compare two "minimised", very similar JavaScript files. Minimisation means that (among other things) newline and space characters that are not needed for interpretation by a ...
Ned64's user avatar
  • 8,736
0 votes
0 answers
30 views

How to diff command outputs in vim

I tried vim -d <(ffprobe one.mp4 2>&1) <(ffprobe two.mp4 2>&1) to see the difference between the two videos' codecs etc., but vim doesn't show anything when it opens, just an empty ...
minseong's user avatar
  • 817
0 votes
1 answer
53 views

Compare text in pdfs when text has been re-flowed

I'm trying to compare text between two versions of a PDF document. I was able to create a diff with pdftotext, format some replacements with perl and colordiff. This output a lot of differences, but ...
snaut's user avatar
  • 101
2 votes
0 answers
48 views

diff -s command says text files are identical when they are not, in zsh on macOS [duplicate]

I've observed unexpected behavior (that seems to be a bug) in diff in recent versions of zsh on macOS, the problem is specifically with the -s directive. diff -s lists difference, but it always adds ...
erik's user avatar
  • 21
0 votes
1 answer
341 views

No such file or directory

I'm trying a command and when I enter it the first time it tells me: diff: llet: No such file or directory but then when I try it a second time, it works... Is there a reason why? Here's the command: ...
cow's user avatar
  • 81
1 vote
0 answers
77 views

diff two multilines bash variables to list what lines aren't in the other

I've created a bash script that Lists the document IDs I've put in an Elastic index, in $liste_ids_lines: a004-événements-examen_individus_localisés_ou_non a020-les_points-leurs_indicateurs-...
Marc Le Bihan's user avatar
0 votes
0 answers
55 views

Help with creating a bash code to compare two different files

I'm currently encountering some challenges while working on a bash script in the Linux terminal to perform the following tasks: Compare the values in the third column of two different files line by ...
duduzba's user avatar
0 votes
1 answer
43 views

diff and comm are not finding difference between two env files

I have this env file 1.env contents: BARF_BAG=1 then another env file: 2.env contents: BARF_BAG=2 I run comm and diff on the files to see the difference: #!/usr/bin/env bash ( set -e; ...
Alexander Mills's user avatar
0 votes
1 answer
43 views

Group results using comm

Using comm I get results that look weird from this: comm -3 <(. "$first_env_file"; env) <(. "$second_env_file"; env) I get something like: AUTH_LP_ACCOUNT_ID=xxx1 ...
Alexander Mills's user avatar
0 votes
1 answer
222 views

diffing two .env files

I have two env files, let's say x.env and y.env, the order of the variables is different, but the content could be the same but likely different. Is there some tool I could use to diff the variables? ...
Alexander Mills's user avatar
0 votes
1 answer
33 views

Force Patch character differences to a file

Hello, I have an englishStrings.json file and when I make new edits/ additions to it, I need to copy the new changes to all the other language string.json files. Before making any changes to ...
Freezer Fridge's user avatar
-1 votes
1 answer
78 views

Complicated DIFF method

I'm trying to do a compare between a config from an old box and a new box to verify Availability and State haven't changed. I have a file that is generated with about a thousand nodes but every node ...
MyWiseGuys's user avatar
0 votes
1 answer
223 views

Best way to compare/diff two big directories that are backups (by `rsync -aAX`) of a boot partition from another computer?

[ EDIT: Answered my own question. Used unison and some hacky post-processing ( copy-pasted the log output of unison, tweaked it in my text-editor with multi-selection editing, then did some shell ...
dwawlyn's user avatar
  • 23
0 votes
1 answer
37 views

Is there a diff(1) that calculates deltas over numbers on each matching line? [duplicate]

Is there any form of diff that detects matching lines, i.e., lines containing the same text, except for numerical values (decimal, octal, hexadecimal), and then calculates the delta for those numbers, ...
matjes's user avatar
  • 1
2 votes
1 answer
237 views

How to use `-s` option of `diff` command

I am using the command(diff) on macOS. The document says: -s --report-identical-files Causes diff to report files which are the same, which are otherwise not mentioned. ...
ITO Yosei's user avatar
  • 121
1 vote
4 answers
113 views

Remove Specific Strings from Text Files to Compare/Diff

I am trying to compare two text files but I need to edit them first to ignore certain strings. Here is an example of one text file: Processing Server ABC-123 oracle 10785 1 0 May17 ? 00:...
user575954's user avatar
1 vote
4 answers
130 views

Find text files where the content is duplicated?

By mistake I appended (>>) rather than overwrote (>) the output from a script that processed thousands of files, but I only did it for about 20 % of the files (I ran 5 parallel instances of ...
d-b's user avatar
  • 1,891
0 votes
1 answer
27 views

Is it possible to make diff suggestions in vimdiff?

I'm comparing two files in vimdiff. For one section of the code in the first file, the same section in the second file has several lines of code added, and then a slightly modified copy of the section ...
wile_e8's user avatar
  • 111
1 vote
1 answer
39 views

How to generate a list of daily changes to my notes?

Background: I use Obsidian to organize my notes as I study. It's an application which works "on top of" a collection of markdown formatted plain text files and then shows the links and ...
mahela007's user avatar
  • 193
3 votes
1 answer
92 views

Why diff3 on inputs from process substitution finds a difference while diff3 on same data in files finds no difference?

diff3 on files finds no difference: $ grep -P '\[\[.*?\]\]' -o intro.tex | sort > A.txt $ grep -P '\[\[.*?\]\]' -o intro.tex | sort | uniq > B.txt $ grep '\\pnum %% \[\[' intro.tex | sed 's/\\...
pmor's user avatar
  • 599
0 votes
1 answer
564 views

Return list using git diff and grep

I'm using git diff to return the file names of files recently changed and i'm trying to pipe the returned file names into a grep expression that searches each file and returns the files that have &...
X13Theo's user avatar
1 vote
1 answer
1k views

ansible comparing all files in 2 directories and printing the difference

I have 2 directories $ tree dir{1..2} dir1 ├── file1 └── file2 dir2 ├── file1 └── file2 I want to compare all files in dir1 with all files in dir2 using ansible and print differences like this output:...
Sollosa's user avatar
  • 1,929
0 votes
1 answer
122 views

What is the purpose of timestamps in unified diffs?

An Example of Unified Format: --- lao 2002-02-21 23:30:39.942229878 -0800 +++ tzu 2002-02-21 23:30:50.442260588 -0800 @@ -1,7 +1,6 @@ -The Way that can be told of is not the eternal Way; -The name ...
Flux's user avatar
  • 2,938
0 votes
0 answers
45 views

diff: delete one line and then add another - what line number is meant in the add command?

There are two files, a and b, with such contents: a apples oranges kiwis carrots b apples kiwis carrots grapefruits Next, I do diff for them: $ diff a b 2d1 < oranges 4a4 > grapefruits After ...
Ilya Loskutov's user avatar
0 votes
0 answers
21 views

Find difference in two set of files in linux [duplicate]

I have two sets of files containing ip addresses file 1 1.1.1.1 2.2.2.2 3.3.3.3 file 2 1.1.1.1 2.2.2.2 4.4.4.4 5.5.5.5 I need to compare two file and print the entry present in file 1 but not in ...
user565262's user avatar
0 votes
0 answers
209 views

Patch malformed error

patch: **** malformed patch at line 225: diff --git the line 225 is this one : diff --git a/files/etc/Compile_info.txt b/files/etc/Compile_info.txt I have a many patches in one file patch and I ...
James78's user avatar
  • 145
2 votes
2 answers
574 views

How to apply a patch as part of a pipe? In other words, how to patch stdin?

I want to apply a unified diff from mypatch.diff to stdin and output the result to stdout. So far, I have tried: patch -i mypatch.diff -o - -u originalfile Which successfully applies mypatch.diff and ...
finefoot's user avatar
  • 3,070
-1 votes
1 answer
154 views

I need to compare/sort two text files

this is the scenario. I have File1 and File2 and i like to have the outcome in File3. I'm kind of new to Linux, but so far ive tried to use sort, diff, and comm. but no luck so far. File1.txt File2....
conny's user avatar
  • 1
0 votes
0 answers
89 views

mv and cp with automatic diff

Is there a program out there like mv and cp, which upon conflict automatically shows a diff before asking whether to override the target file? This is such a basic feature in graphical file managers, ...
xeruf's user avatar
  • 551
-1 votes
1 answer
56 views

find the different string from file comparison in unix

I have 2 files: File1: DX 100860599215|732512737|00002|40|1|20220105|20220105|20220523|31014280|5892720|36907000|1|20220105|40|20|D| File2 DX 100860599216|732512737|00002|40|1|20220105|20220105|...
prex's user avatar
  • 1
-3 votes
2 answers
874 views

How to get difference of two csv files by columns and write diff into 3rd file?

I have two csv files like this; 422174,XN,20.99,2020-09-01,2022-01-20 20:20:28.613+00 421348,SB,21.99,2021-01-26,2022-01-20 20:20:28.613+00 885176,XN,41.80,2021-11-17,2022-01-20 20:20:28.613+00 881751,...
Burak's user avatar
  • 27
-1 votes
1 answer
607 views

How to get difference of two csv files and write diff into 3rd file?

I have two csv files like this; 422174,XN,20.99,2020-09-01,2022-01-20 20:20:28.613+00 421348,SB,21.99,2021-01-26,2022-01-20 20:20:28.613+00 885176,XN,41.80,2021-11-17,2022-01-20 20:20:28.613+00 881751,...
Burak's user avatar
  • 27
10 votes
1 answer
1k views

Space not taken as an argument separator by shell script (could someone please explain that small file difference ?)

SHORT VERSION (TL;DR) I have 2 small one-line files, seemingly identical : $ cat f1 f2 ./cconv.sh 100 EUR USD ./cconv.sh 100 EUR USD But they are not, there is a 1 byte difference in size : $ ls -l ...
ChennyStar's user avatar
  • 1,743
3 votes
0 answers
190 views

How to limit "diff -r" to a certain depth?

How can I compare sub-directories in two directories down to a certain directory depth? Command diff doesn't have an option to specify depth, and -r option takes you all the way down to the files, ...
Renat's user avatar
  • 131
0 votes
1 answer
223 views

Diffing two directories well

I need to diff (and merge) two directories (practically same content, with a few extra inserted lines in one set of files). Alas, all diff programs I tried (kompare, diffmerge, kdiff3, diffuse, xxdiff,...
vishvAs vAsuki's user avatar
0 votes
2 answers
1k views

How I can get the missing lines from a.txt files using diff?

I have the following files: a.txt 1 2 11 22 33 444 b.txt 1 2 3 11 22 33 555 I want to retrieve the lines from a.txt that do not exists on b.txt. I tried with that: diff a.txt b.txt -d 2a3 > 3 6c7 ...
Dimitrios Desyllas's user avatar
4 votes
3 answers
576 views

Merging two non-git-based text files with similar semantics to the depiction of git merge conflicts

I would like to merge two non-git-based text files using semantics that are similar to to how git depicts "merge conflicts". For example, suppose I have two text files with similar but not ...
HippoMan's user avatar
  • 605
1 vote
1 answer
70 views

How to display line differences between 2 files while considering "modified lines"?

I have 2 files file1 and file2 that are sorted and contain mostly similar lines. I want to display added/modified/suppressed lines between these 2 files. The catch is in the definition of a "...
mido's user avatar
  • 11
0 votes
0 answers
139 views

How to get binary diff size of two folders

I need to know the size (in bytes) of binary difference between two folders containing hundreds of files. ideally searching for a tool where something like xtool --recursive /path/to/folderA/path/to/...
Orsiris de Jong's user avatar
-1 votes
1 answer
187 views

Machine readable output of "diff -r"

Is there any machine readable output for comparing two directories with diff? If I do diff -rq a b I get: Only in a: aa Only in b: bb Files a/t and b/t differ But maybe something like the following ...
white_gecko's user avatar
0 votes
1 answer
288 views

Have git diff color customization

How can git diff color be changed to one's disposal, or such as for diff ...? in ~/.gitconfig: [color "diff"] added = yellow changed = red bold not work. Please sincere help appreciated
cantik memekmu's user avatar

1
2 3 4 5
11