Questions tagged [file-comparison]

140 questions
117
votes
7 answers

rsync compare directories?

Is it possible to compare two directories with rsync and only print the differences? There's a dry-run option, but when I increase verbosity to a certain level, every file compared is shown. ls -alR and diff is no option here, since there are…
chris
  • 1,635
  • 2
  • 16
  • 19
40
votes
10 answers

Compare directories but not content of files

With diff -r I can do this task, however it takes so long because diff checks file's content. I want something that determine that two files are the same regarding of their size, last modified, etc. But no checking bit by bit the file (for example…
user27807
31
votes
3 answers

Two files comparison in bash script?

How to find two files matched data in shell script and duplicate data store in another file in shell? #!/bin/bash file1="/home/vekomy/santhosh/bigfiles.txt" file2="/home/vekomy/santhosh/bigfile2.txt" while read -r $file1; do while read -r…
santhosh reddy
  • 345
  • 1
  • 3
  • 4
17
votes
8 answers

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, say, in addition to that, 16 equidistant chunks…
vume
  • 173
  • 1
  • 4
17
votes
3 answers

Compare two files for matching lines and store positive results

I have two files. File 1: A0001 C001 B0003 C896 A0024 C234 . B1542 C231 . upto 28412 such lines File 2: A0001 A0024 B1542 . . and 12000 such lines. I want to compare File 2 against File 1 and store the matching lines from File 1. I tried Perl…
user3543389
  • 195
  • 1
  • 1
  • 5
16
votes
2 answers

Compare two files strictly line-by-line, without insertions or deletions

I have two files that essentially contain a memory dumps in a hex format. At the moment I use diff to see if the files are different and where the differences are. However, this can be misleading when trying to determine the exact location (i.e.…
Fritz
  • 632
  • 2
  • 6
  • 16
16
votes
7 answers

How to know if a text file is a subset of another

I am trying to find a way to determine if a text file is a subset of another.. For example: foo bar is a subset of foo bar pluto While: foo pluto and foo bar are not a subset of each other... Is there a way to do this with a command? This check…
gc5
  • 369
  • 4
  • 8
15
votes
3 answers

How can I check if two gzipped files are equal?

I am trying to save space while doing a "dumb" backup by simply dumping data into a text file. My backup script is executed daily and looks like this: Create a directory named after the backup date. Dump some data into a text file "$name". If the…
Lekensteyn
  • 20,173
  • 18
  • 71
  • 111
13
votes
3 answers

How to check whether file1 is a prefix of file2?

I have two files with sizes 124665 and 124858 in bytes and want to check whether file1 is a prefix of file2 or not.
tvorog
  • 253
  • 1
  • 5
12
votes
3 answers

Tool to compare 2 excel sheets in linux

I want to be able to compare 2 excel sheets in linux. I am not interested in converting them to csv format as they have a complicated formating that is not supported in csv. I would like to be able to have a graphical comparison (some sort of…
Debugger
  • 427
  • 2
  • 4
  • 5
11
votes
3 answers

Using Diff on a specific column in a file

Will it be possible to use diff on a specific columns in a file? file1 Something 123 item1 Something 456 item2 Something 768 item3 Something 353 item4 file2 Another 123 stuff1 Another 193 stuff2 Another 783 stuff3 Another 353…
kickass13
  • 113
  • 1
  • 1
  • 4
10
votes
4 answers

how to compare two xml files having same data in different lines?

I have two files have same data but in different lines. File 1: 048206031415072010Comcast.USR8JR ccp_test_79 JOSH CCP
user32026
  • 101
  • 1
  • 1
  • 3
10
votes
1 answer

Find all folders in a directory with the same content

In Ubuntu, is there any to find duplicate folders in a directory (i. e., folders with the same content)? I think there are already some command-line tools available for finding duplicate files (such as fdupes), but I want to find duplicate folders…
Anderson Green
  • 521
  • 2
  • 7
  • 17
10
votes
2 answers

diff characterwise

Is there a stable tool (option/plugin of an existing tool: vimdiff, diff, etc) in Linux to do diff between two text files characterwise? I would like to see the longest common subsequence between my two files highlighted. There is a classic…
Valentas
  • 349
  • 2
  • 9
10
votes
3 answers

How to compare directories with binary files

I'd like to compare directories with binary files. Actually, I'm not interested in what the actual differences between files are, but to know if there's a differ (and what files differ). Previously I used meld, but it's cannot compare binary…
Loom
  • 3,863
  • 11
  • 30
  • 44
1
2 3
9 10