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
1 answer
24 views

Confusing Results from diff

I got the following results from diff: @@ -4479,7 +4479,7 @@ || AddPrintCheckParameters(TRUE) || AddRecipeDefaults(TRUE) || AddRepeatScanPass(TRUE) - || AddVirgoFlag(...
user avatar
  • 145
0 votes
2 answers
44 views

how to compare all files inside ONE directory in bash?

example given: dir1/ file1 file2 file3 file4 how do you compare file1-file2, file1-file3, file1-file4 then file2->file3, file2->file4 and so on. In this case the name is file_number, but ...
user avatar
0 votes
1 answer
31 views

looking to compare two directories using boolean statement

just looking to compare two directories and make sure that all files reside in both, I'm aware of the diff cmd but is there a way to use Boolean logic? if directory a contents == directory b contents ...
user avatar
1 vote
3 answers
45 views

diff: Find files that differ and are in the second directory

Say that I have these files for example: old/common-change/index.html new/common-change/index.html new/only-new/index.html old/only-old/index.html The output of diff -qr is close to what I want: $ ...
user avatar
3 votes
2 answers
284 views

diff program gives false positive for files with non-ASCII characters in filename

Example: % diff "/Volumes/New Volume/4kyoutube/" "/Volumes/New Volume/tmpmusic"| grep Distortion Only in /Volumes/New Volume/tmpmusic: ZAC & Bäkka - Distortion (Original Mix) [...
user avatar
0 votes
1 answer
38 views

A printf format for "find" or a means to control diff in comparing files across file systems

Working from home, the contents of my laptop undergoes a lot of changes. Before lockdown, I was usually in the office, and I could manually mirror files to a network drive. Working from home means no ...
user avatar
0 votes
1 answer
33 views

How to create a directory tree with only the changed files of two source directory trees

I have two directory trees (actually macOS volumes) with similar files and want to create a third directory tree containing only the files which are changed between the two source trees. How can I do ...
user avatar
  • 315
0 votes
1 answer
38 views

Relaxing cmp conditions on diff

Is there a independent diff tool that ignores differences as long as they're only related to row ordering and not content? For example, a.txt: aa bb and b.txt: bb aa should be identical, since they ...
user avatar
  • 895
1 vote
0 answers
32 views

Unexpected result from diff

Isn't the output contradictory? diff reports that the file is only in one of the locations. But then when I check with ls, the file is there. What is the reason? Is it because the filename contains ...
user avatar
0 votes
0 answers
52 views

Diff says that files differ after copying them with cp -a

I have a flash drive which I backed up onto a disk with the following command: cp -a /media/user/flashDrive /home/user/Documents/flashBackup Now I just wanted to quickly check if the files were ...
user avatar
1 vote
2 answers
67 views

`diff` on files without newlines

I need to diff on a file that isn't ASCII and haven't newlines. I want ideally to see what is new, what is deleted, what is modified, and maybe see the proportion (percentage, size) who is different ...
user avatar
  • 13
0 votes
0 answers
30 views

Bash, diff -qr --exclude=*alldirectories

The problem is simple. I do not want: diff -qr [...where i need help...] dir1 dir2 To ever so much as compare any directory. If a directory is only present in one of the two to compare, I DO NOT want ...
user avatar
0 votes
1 answer
31 views

How to keep file names when using diff with regex

I am using this diff to show whether two files differ, but I need the regex to ignore the lines that are different that I don't care about. But the way it is set up it changes the names of the files ...
user avatar
0 votes
0 answers
10 views

Kompare adding extra slash when saving new file

I am using Kompare (Ubuntu 21.10) to compare directories in a project. I pick my source and destination, and everything seems to be fine. Except when there is a new file in the source. I click on &...
user avatar
0 votes
1 answer
47 views

diff with or without --brief

When comparing the file contents of two directories using diff dirA dirB, what are the differences between with or without the --brief option? As far as I notice, by default diff reports only when ...
user avatar
  • 233
0 votes
1 answer
23 views

Can diff change the root path name in its output for patch files?

You constantly see kernel patches where it's a/subdir/file.c b/subdir/file.c. Say in reality you have linux-5.10.37_org and linux-5.10.37_mod, is there a way to get the a and b output without having ...
user avatar
0 votes
1 answer
83 views

How to diff folders and get verbose information?

I have 2 ~55 Gb folders (with many subfolders) that contain more than 1500 files per ~30 Mb. I need to compare them and get information if some files are missing / new files persist or their hash is ...
user avatar
  • 47
0 votes
2 answers
119 views

Show differences in strings

This answer shows how to diff two strings - Using the diff command to compare two strings? I try: diff <( printf '%s\n' "tring1" ) <( printf '%s\n' "string2" ) The output is:...
user avatar
  • 861
-2 votes
1 answer
25 views

How to show colred red green diff patch?

I already generated a diff patch between 2 files: diff file1 file2 > file3 Does there a way to display properly the file3 path, in a colored way. cat file3 do the job but there's no colors.
user avatar
1 vote
3 answers
66 views

How to get the difference between files

I've found other links on the stackoverflow communities that were similar but they didn't answer my question exactly. I have 2 files with a different number of lines BUT I have them both sorted. My ...
user avatar
0 votes
0 answers
27 views

Diff says two files differ, although they are identical [duplicate]

I tried to compare 2 identical files using diff command and got: -bash-4.2$ diff tests/out1.txt myout1.txt | cat -t < init done.^M ___ > init done. I once read that this has to do with new ...
user avatar
  • 1
-3 votes
1 answer
56 views

Difference between diff and sum utilities

We use diff for finding difference between two files. We use checksum utilities for finding hashes and compare them later. In this regards, I have some questions : Can we diff any type of file ? For ...
user avatar
0 votes
3 answers
351 views

How to create a patch for renaming a file

Suppose I have a file (myfile.txt) containing this text: The quick brown fox jumps over the lazy dog. I rename this file from myfile.txt to mystory.txt. How do I create a diff that represents this ...
user avatar
  • 1,812
0 votes
3 answers
43 views

tree command: Can you prevent the formatting dependancy on the final item?

I am using tree and diff to compare a local directory with a USB backup version of the same directory, and to identify noteworthy / discardable differences. $ cd home/dir/ $ tree --charset=ascii -af . ...
user avatar
0 votes
1 answer
568 views

How to ignore timestamp of the files while performing diff operation

I created a file named me.txt with text This is dummy text Then I made a TAR out of it and named me.txt.tar. Now after a minute I again created a file with exactly same name and the text (basically I ...
user avatar
0 votes
2 answers
64 views

How to compare two tsv extract in Unix and print differences with key and header?

I have two files with same header and structure and the first column is a key. File 1: key val1 val2 val3 val4 val5 Item1 10 12 44 88 22 Item2 33 33 43 77 22 Item3 28 44 55 ...
user avatar
0 votes
2 answers
72 views

get only the unmatched list as an output

I want to know on which ports of firewalls from a particular customer the MAC Address Filtering is not active. So I have created 2 files: all.txt contains a list of all firewalls of a customer and ...
user avatar
1 vote
4 answers
67 views

Comparing files in a directory

Suppose I have x amount of files in a directory (where x = greater than 100) and I want to compare these files for differences. How can I accomplish this task? I am running an Ubuntu 18.04 machine. ...
user avatar
  • 25
1 vote
1 answer
33 views

How to compare corresponding multiple files with each other in the same directory

Hi so I have a folder like /mell/908 which contains files as follows: cf-mell-pos-908-tcg-4619e.txt cf-mell-pos-908-tcw-4619e.txt cf-mell-pos-908-usc-4619e.txt cf-mell-pos-908-wi_board-4619e.txt ...
user avatar
  • 13
-1 votes
1 answer
56 views

diff: what does this output indicate? [duplicate]

I am using the following command to log the difference between two files on my disk to a log: diff --color=always -sy --suppress-common-lines --suppress-blank-empty file1.c file2.c >> diff_log....
user avatar
  • 133
2 votes
2 answers
239 views

git diff: create custom function/macro to ignore comments

I have following function in zsh, which basically works as diff, but it ignores comments (lines starting with # or empty lines) when comparing files: function cdiff() { local args=("${(M)@:#-*}&...
user avatar
0 votes
1 answer
45 views

recursively diff two directories ignoring a single word

I would like to diff two directories recursively, ignoring one particular string replacement. For example, in one directory, some files contain the string "abcd" whereas in the other ...
user avatar
  • 125
1 vote
1 answer
222 views

How do you merge files with dispatch-conf?

Sorry for such a simple question, but I can't figure this out for the life of me. Neither DISPATCH-CONF(1) nor wiki.gentoo.org/wiki/Dispatch-conf provide any instructions. When running dispatch-conf: ...
user avatar
  • 167
-1 votes
2 answers
76 views

How to measure the similarity or the distance between human readable text files (license files)?

I want to find out which license a source tree has. The computer should make a suggestion which license files match closely. Then I would like to compare the texts with meld manually. In a typical ...
user avatar
  • 3,573
2 votes
2 answers
361 views

Why downloading the same web page twice with wget results in two files which differ?

I'm trying to write a script that notifies me when a static web page has changed. To do it, I'm using wget to download the web page, and diff to check whether it has changed or not. I'm running an ...
user avatar
0 votes
0 answers
17 views

Hide non overlaps but show all three versions in diff3

diff3 calls the same change in both branches a non overlapping conflict. --show-all bothers you with these mostly harmless changes. --show-overlap accepts them, as I want, but doesn't show you the ...
user avatar
0 votes
2 answers
327 views

Compare content of two folders/disks (including timestamps,permissions)

I have two directories on two different hard drives and want to check if the content is really exactly the same. From what I read I can use diff -rq dir1 dir2 to check if files are missing or differ. ...
user avatar
0 votes
0 answers
30 views

Colorizing a diff of diffs in git

The setup I wrote a script that checks if a merge commit was resolved successfully by displaying a diff of diffs before an after the merge. For example, if my history looks like this: * 5c8cb0d2 merge ...
user avatar
  • 101
2 votes
2 answers
246 views

Ignore certain lines when creating/applying a patch with diff/patch?

File A Apples Bananas Clementines Dates File B Apples Blueberries Cherries Dates I want to diff A and B to generate a patch that when applied to C will change the line Clementines > Cherries but ...
user avatar
0 votes
1 answer
154 views

How to use sed to remove letters, numbers, spaces, hyphens from the same linux string

I am trying to create a script to monitor a web page and send a telegram notification whenever there is a change in that page, I am using diff to accomplish this task. The script seems to work well ...
user avatar
  • 3
0 votes
1 answer
63 views

how to diff automatically between file.txt.orig and file.txt

Currently, I am editing files on vim by setting patchmode=.orig and then, having two files: file.txt.orig <- backup without changes file.txt <- update file However, I would like to generate a ...
user avatar
  • 261
2 votes
2 answers
186 views

Display git-diff between master and my last commit

I use git on a regular basis for collaboration with other people. When we work together on a shared repository, I'd like to be able to view the changes performed by others which happened between my ...
user avatar
  • 198
0 votes
0 answers
156 views

Patch unable to find file

I am currently in directory - /usr/lib/llvm-9/build The include/ directory is a symlink - reikdas@reikdas-VirtualBox:/usr/lib/llvm-9/build$ ls -l lrwxrwxrwx 1 root root 10 Jan 31 2020 include -> ../...
user avatar
0 votes
1 answer
33 views

Rebasing a patch without using git?

I've never used maintained files created with patch and diff. But what is the work flow when the patch drifts? As in this case. I can see the the failures when I do -m in the same format git would ...
user avatar
  • 22.4k
1 vote
0 answers
82 views

Merge two corrupted copies of same file to fix errors / finding parts of files of same size that differ

Having mirror copy of hard drive I noted few files became different one copy from another (by sha256 check). I would like to merge these two to several versions of file one of which I hope would be ...
user avatar
0 votes
1 answer
33 views

How to list all files that occur SOMEWHERE in one folder but not another?

I have a folder with a lot of subfolders and files (let's call it 'orig'), and another folder where a lot of the same files were placed as backups in a different folder structure (let's call it '...
user avatar
0 votes
1 answer
124 views

What does 'grep -v "^[...]"' mean?

I wrote a line like this diff fileA.txt fileB.txt | grep -v "^[11,12d9]" . Without the grep part, the output would look like this: 1d0 < loop 11,12d9 < polo < pool But ...
user avatar
  • 3
1 vote
0 answers
324 views

diff doesn't return anything, but total size is different?

Usually I like to use a following diff command setup to recursively compare 2 directory structures: diff --brief --recursive dir/one dir/two However on my last attempt it returned nothing, so I ...
user avatar
  • 152
0 votes
2 answers
182 views

Unix Commands Questions - mv, pwd, chmod, and others

I wanted to make sure Im matching the correct command to the description, including possible tags I may need and I'd really appreciate if someone could confirm them for me: Show file permissions for ...
user avatar
  • 1
0 votes
1 answer
216 views

Efficient way to get the difference between two files in linux?

I've been trying to get the difference between two huge .txt files (> 6Gb each) in linux. I have tried all the variants of diff, but the problem is that the process is soon aborted and ends with &...
user avatar

1
2 3 4 5
10