Questions tagged [file-comparison]

146 questions
3
votes
1 answer

`cmp -b file1 file2` responses: "file1 file2 differ: 12 byte, line 2 is 154 l 151 i", what is '154' and '151' in reference to?

$ cmp -b file1 file2 file1 file2 differ: 12 byte, line 2 is 154 l 151 i in this response what do '154' and '151' refer to?
2
votes
1 answer

binary compare two files, failing only if first never matches any part of the second

I have a file (call it A, for reference) that may be a fragment of some other extant file on my system. I can't use cmp because I don't know how many bytes may be missing from the start of A (or, at least, I can't use it without brute forcing…
Zorawar
  • 845
1
vote
1 answer

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 would be greatly appreciated.
1
vote
2 answers

Compare files and select bigger one

There are two directories with many files. Those files are always matching in names and not always matching in size. For example: /dir1 |-file1 (1 MB) |-file2 (2 MB) |-file3 (3 MB) /dir2 |-file1 (1 KB) |-file2 (2 MB) |-file3 (10 MB) As you see,…
Dmitrii Medvedev
  • 168
  • 1
  • 10
1
vote
0 answers

Comparing binary files until EOF

I have a script that uses dd to write a disk image containing a Linux image to an SD card. This SD card is used by an ARM controller to boot Linux from. Most of the times this works quite well, but occasionally something seems to go wrong and the…
0
votes
3 answers

Bit comparison between two files

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 compare bits, not characters. Reading through the…
0
votes
1 answer

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 [[ RCS/$dog* -nt dog ]] ; then echo not older than dog ;…
Leo Simon
  • 453
0
votes
2 answers

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 want to check, for each line, that file2.txt contains the…
0
votes
2 answers

Compare two files and print matches in the first file adding extra column

I have two different files with one column each. The file 1 has more info and I want a command to search the matches against the file 2 and then return the original file 1 with an extra column saying for example "match" File 1 Mg_134 Mg_560 File…
Alex
  • 334
  • 5
  • 15
-1
votes
4 answers

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 files vary. How could this be done? So in this case,…
X3nion
  • 33
-1
votes
2 answers

Compare two files and output match

I have files similar to this: File1: 1.1.1.7 mounting of udf filesystems is disabled Fail 1.1.1.8 mounting of FAT filesystems is disabled Fail 1.1.5 noexec option set on /tmp partition Fail 1.1.17 noexec option set on /dev/shm partition …