Skip to main content

Questions tagged [file-comparison]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

check files difference with multiple folders

I would like to check when a file differ inside a backup system using snapshots. I have several folders with the same architecture inside ls -1 .snapshot 4-hourly.2024-04-14_0405 4-hourly.2024-04-...
ppr's user avatar
  • 1,917
0 votes
1 answer
35 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
82 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
  • 333
0 votes
2 answers
66 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
  • 611
4 votes
4 answers
366 views

Awk- Compare Numbers from Two Files and write Differences in New File

I have two lists with item numbers and want to mark the difference between these lists by writing the numbers wich aren't in both files in a new file. Both Files have the item number in column 2 and ...
user avatar
1 vote
1 answer
126 views

Watch a folder for new folders, cd into folder (and subfolders) and execute script

I have a lot of audio files to convert and I like this to happen automatically when moving a folder with files into another folder, where the magic should happen. It's on a debian system. Any help ...
Robert van Wingen's user avatar
0 votes
0 answers
59 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
359 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
1 vote
1 answer
41 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
1 vote
1 answer
2k 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,951
0 votes
1 answer
49 views

Can i skip a pattern and also print that pattern along with line by line file comparison using awk?

I have the code below (please see Need to understand below awk command to find missing lines in a file): awk 'NR==FNR{a[$0];next}(!($0 in a)){print}' 1.txt 2.txt Can I add one more condition to skip ...
dbadmin's user avatar
  • 23
0 votes
3 answers
282 views

Compare directories ignoring time differences of 1h +- 2s

I often want to synchronize my Music folders between my Android mobile phone and my Linux PC. The files on my phone are stored on an SD card using FAT32 and can come from either my Windows laptop or ...
DodgyCodeException's user avatar
1 vote
1 answer
291 views

How to calculate a single checksum for each folder in a directory?

I am comparing two large directories between a server and a client machine. I run a command similar to the one below to determine if the two directories are the same or not. find /path/to/dir/ -type f ...
ricardo3889's user avatar
-3 votes
2 answers
965 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
2 answers
121 views

compare the two files

Please suggest how can we compare two files having major part similar but in a jumbled way. example: A file has 72444 55555 72445 55666 55666 72446 B File has 72444 55555 55666 72446 72445 55666 ...
Surya Shukla's user avatar
0 votes
0 answers
114 views

command/app to compare epub files

Is there any easy way to compare the first line/text of a epub file using command line or an app in Linux? Details: I have 15 different epub files, each with over 10 "chapters", I'd like to ...
michaelbr's user avatar
  • 111
17 votes
8 answers
5k views

Is there a tool or script that can very quickly find duplicates by only comparing filesize and a small fraction of the file contents?

Tools like fdupes are ridiculous overkill when dealing with jpg or h264 compressed files. Two such files having the exact same filesize is already a pretty good indication of them being identical. If, ...
vume's user avatar
  • 173
3 votes
2 answers
406 views

Extract the indexes of rows that are swapped in order between two files

I have two large tab-delimited files (>10GB) and I know that when they're sorted, they're identical in content. However, I'm interested in the order of rows and the index of the swapped ones when ...
paropunam's user avatar
  • 257
0 votes
1 answer
115 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 ...
halloleo's user avatar
  • 589
1 vote
3 answers
967 views

How to compare huge files with progress information

In a Unix command line context I would like to compare two truly huge files (around 1TB each), preferable with a progress indicator. I have tried diff and cmp, and they both crashed the system (macOS ...
halloleo's user avatar
  • 589
0 votes
1 answer
222 views

compare multiple files rows by two columns, match the first compare the second

I have two input files like these: file1 ABC001;text;text;5.00;text;text;;20/06/2020;http://www.domain.com/img/foobar4325.jpg ABC002;text;text;15.20;text;text;;4/12/2021;http://www.domain.com/img/...
Kintaro's user avatar
  • 17
0 votes
3 answers
2k views

Bit comparison between two files [closed]

I am in the process of learning bash, and I need to compare two almost identical text files (only a few bits are flipped) and output the amount of bits that are the same. In other words, I need to ...
lostintranslation's user avatar
-3 votes
1 answer
1k 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 ...
cheesesticks's user avatar
-1 votes
2 answers
321 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 ...
Jonas Stein's user avatar
  • 4,138
-2 votes
1 answer
150 views

Unix file matching logic

I have a project requirement in which I need to read file1 from top to bottom and match column 2 of it with column 3 of file2. Both files are tab delimited. If a record matches, I have to write full ...
Shubham Sharma's user avatar
-1 votes
1 answer
449 views

cmp-command for three files

I'd like to compare three text files using the cmp-command in bash and perform an action, if file1 differs from file2, but file1 and file3 are exactly the same. As according to the help-file, cmp ...
X3nion's user avatar
  • 33
0 votes
0 answers
877 views

How to use rsync correctly to compare file hashes of two directories incl. subdirectories and interpret its output?

To check equality of a local and a remote directory I want to compare the hashes of all the files and did: $ rsync -avcn /home/me-here/thisss/ [email protected]:/home/me-there/thisss/ > diffs.txt ...
jay.sf's user avatar
  • 227
2 votes
1 answer
1k views

Compare the first 20 lines of two files

What is an easy way I can compare the first 20 lines (or n lines) of two files? I had set up an automated pg_dump, but it turns out the dumps being created are corrupt and now won't restore. I still ...
J86's user avatar
  • 393
1 vote
0 answers
946 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 ...
jave.web's user avatar
  • 152
1 vote
2 answers
134 views

why is rsync ignoring a newer directory here?

I have two directories containing alot of subdirectories. I want to compare the directories and find the the subdirectories which are missing in the second one and those who are newer in the first ...
bengt's user avatar
  • 11
0 votes
1 answer
210 views

Comparison of N identical continuous characters from a set of two files with sequences

I have two files of each with 3 sequences (200 length each) with a header like this: #File1 >1 ...
GSQ's user avatar
  • 37
2 votes
0 answers
258 views

Find the (likely) git commit from which a version was branched

I have a directory containing files that were originally checked out from Git, then modified. Unfortunately, I don't have any of the Git metadata. I'd like to know what Git commit that directory's ...
Gilles 'SO- stop being evil''s user avatar
2 votes
1 answer
2k views

ImageMagick compare without generating diff image

I'm using ImageMagick compare to calculate the difference between two images every five minutes on a Raspberry Pi. This takes almost a minute, and I suspect much of the CPU load is due to the ...
OZ1SEJ's user avatar
  • 197
-1 votes
4 answers
127 views

Comparing two files according to individual criterion

I've got two text files, e.g. File1.txt: A B C E and File2.txt: C D E where the letters stand for lines. I'd like to find all results in File1.txt, that are not in File2.txt The results in both ...
X3nion's user avatar
  • 33
7 votes
3 answers
10k views

I want to compare values of two files, but not based on position or sequence

Suppose that I have the two files with the following content: $ cat File1.txt Apple orange watermelon avocado lime $ cat File2.txt orange Apple lime watermelon avocado Basically, there is no ...
ansinha's user avatar
  • 85
2 votes
4 answers
177 views

Compare 60 large files and output only the lines that are common to all files

I Have 60 files, each contain about 10,000 lines. Each line contains a single string. I want to find out only the strings that are common to all files. Must be exact matches, so we are comparing the ...
Chris's user avatar
  • 21
2 votes
4 answers
2k views

Diff only words in files

I have two files I need to compare. Problem is, indentation and newlines have different formatting so just diff file1 file2 returns the entire output of both files. Is there any way to ignore ...
unixandria's user avatar
1 vote
1 answer
41 views

Acuracy Level of md5sum Comparison

Doing here some file listing with find command as follows: find /dir1/ -type f -exec md5sum {} + | sort -k 2 > dir1.txt Then: find /dir2/ -type f -exec md5sum {} + | sort -k 2 > dir2.txt ...
Ferrari21's user avatar
  • 338
2 votes
2 answers
166 views

Comparing two columns(numeric) in two different text files

I have two text files with space-delimited fields (03 fields) in Linux environment: File1 : ram-service1.txt RAM used Program 23500 kb firewalld 14780 kb tuned 10140 kb polkitd 5370 ...
Lasith Anjula Galanga's user avatar
0 votes
1 answer
23 views

bash logical comparison give the wrong answer for RCS files ending in ,v

The command ls -al dog RCS/dog,v returns -rw-r--r-- 1 simon simon 0 Apr 13 19:25 dog -r--r--r-- 1 simon simon 191 Apr 13 19:28 RCS/dog,v indicating that RCS/dog,v is newer than dog, yet if [[ ...
Leo Simon's user avatar
  • 453
3 votes
5 answers
2k views

Compare 2 files based on the first column and print the not matched

File# 1: test1,1 test2,2 test3 File# 2: test2 test1 test4 Desired Output: test4
αԋɱҽԃ αмєяιcαη's user avatar
0 votes
2 answers
220 views

Matching columns of File1 to columns of file 2 and printing them in a file using awk

I am new to awk and trying to compare ":" separated columns 1(eg., chr10) and 2 (eg 10000003) between file1 and file 2 ; and write the matching lines into a new file using awk. File 1: chr10:...
Gul's user avatar
  • 1
0 votes
2 answers
2k views

Check if one list contains strings contained in another list

I have a list of strings, say file1.txt: a B ccc D E f and another list of strings, i.e. file2.txt: a x y z 43 5 B aa_f <|ccc |D> E FFF I ...
user393431's user avatar
0 votes
1 answer
526 views

Is there any GUI comparison tool to check folders in two machine?

Some of my dev machine is one network and test machines in different network. Due to this often we are changing code in test machine and validate it then move the code to dev machine. I know this is ...
Samselvaprabu's user avatar
0 votes
2 answers
2k views

Compare large directories recursively - but ignoring sub-directories - compare two backups - with gui

I've got 2 very old Backups of a friends computer. They were simply copied into a folder each on an external Harddrive. Both are about 300GB in Size and the contents are very much alike but not ...
Turtlepurple's user avatar
2 votes
2 answers
2k views

Delete file when there is no difference

I'm completely new to bash. I have a requirement that needs to do the following: Iterate through a directory A's and directory B's folders with the same name Find two files that have the same name ...
Minz's user avatar
  • 35
3 votes
1 answer
2k views

How compare two binary files, showing long portions that match?

I have two pcapng files, and I'd like to compare them showing the matching portions and not. Basically, I know that in these 2 files each block header is different, but the block data are the same. ...
Valonqar's user avatar
0 votes
1 answer
2k views

Compare two .csv file and write diff into 3rd file

I have two .csv files test_case_list.csv and test_case_summary.csv and I want to generate a third file that will have the difference of two files. test_case_list.csv looks like: cli-verify-cvlan-...
patiladarsh94's user avatar
0 votes
1 answer
2k views

Compare 2 files and run the script when there is a difference

I have a shell script for working with text conversions, but it is cumbersome to use and relies on manual judgment and execution. It works as follows. Step 1: download raw data text. wget http://...
Matthew's user avatar
  • 351
0 votes
0 answers
323 views

Comparing Files inside Tar on Unix

I want to know how can I compare some files inside a tar one with these same files in one directory and if these file exists in the directory, proceed to delete them. I tried using diff and tar -tvf ...
vicdeveloper's user avatar