Questions tagged [diff]
diff - Command-line tool to display the differences between two files, or each corresponding file in two directories.
554 questions
-1
votes
1
answer
71
views
patch fails on unified diff, but works fine with context diff
I am struggling with understanding how diff and patch are supposed to work. Here's my use case: I use Betterfox user.js config file for my Firefox profile, but I add some overrides to it. I want to ...
0
votes
0
answers
54
views
ubuntu system freeze while diff reading, SysRq REISUB not working
I've experienced total system freeze while checking if files where copied correctly by
diff -rq [INTERNAL HDD] [USB HDD]
This happened twice, always while running the diff. On the second occasion I ...
0
votes
1
answer
97
views
How to save changes to patch files for kernel headers in `include/linux` using `diff`?
I am trying to hack the Linux kernel and added/modified some header files in include/linux. However, when I generate patch file using diff like:
diff -uprN -X linux/Documentation/dontdiff \
...
0
votes
2
answers
125
views
In bash/zsh, how to compare the metadata in two directories including . and excluding .. and the contents inside subdirectories?
Let's say that in a script, you have a directory $1 and its copy $2 and you'd like to compare the metadata (names, permissions, sizes, full modification dates, …) of the files and directories inside ...
0
votes
1
answer
133
views
How to quickly find the largest files/dirs that differ between two directories that should be identical on Linux?
I'm trying to synchronize two hard drives. I thought most people who don't want to lose any data and don't use RAID would use such a method so that there would be a well-working GUI. That doesn't seem ...
0
votes
1
answer
73
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 ...
0
votes
1
answer
161
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 ...
2
votes
1
answer
1k
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 ...
2
votes
3
answers
523
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 ...
0
votes
0
answers
68
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 ...
2
votes
0
answers
49
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 ...
1
vote
0
answers
178
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-...
0
votes
1
answer
56
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;
...
1
vote
1
answer
1k
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?
...
-1
votes
1
answer
108
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 ...
0
votes
1
answer
51
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, ...
1
vote
4
answers
208
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:...
0
votes
1
answer
48
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 ...
3
votes
1
answer
121
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/\\...
1
vote
1
answer
3k
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:...
0
votes
0
answers
110
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 ...
0
votes
0
answers
411
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 ...
-1
votes
1
answer
517
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....
-1
votes
1
answer
69
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|...
-1
votes
1
answer
915
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,...