Matt Kosht <com> writes:
I've never heard of mdsum, but try mtree(8).
Is there a simple way to compare the md5 checksum of a file, to a file that contains possibly more than one md5 checksum entry in it? Kind of like mdsum -c does?...
Is there a simple way to compare the md5 checksum of a file, to a file
that contains possibly more than one md5 checksum entry in it? Kind
of like mdsum -c does?
Matt Kosht <com> writes:
I've never heard of mdsum, but try mtree(8).
Compare md5 sums:
$ md5 file1 file2 file3 > checksum.md5
$ md5 file1 file2 file3 | diff checksum.md5 -
On Tue, Mar 29, 2005 at 10:29:39PM -0500, Matt Kosht wrote:
--
You can get a lot her with a kind word and a gun
than with a kind word alone.
-- Al Capone
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2005-03-30, Lowell Gilbert scribbled these
curious markings:
>
> I've never heard of mdsum, but try mtree(8).[/ref]
Matt is (modulo a typo) referring to the GNU tool md5sum, which is
oh-so-conveniently named differently than the FreeBSD utility (which
causes programs that call it, like mplayer modulo the patch that I sent
in, to fail with "md5sum: not found" errors).
To answer Matt's original question, I've found that something like this
works well. This assumes that CHECKSUM contains the actual checksum of
the file, and only the checksum of that file.
md5 FILE > mine
cmp mine CHECKSUM
Not as short as the GNU version, but still mostly functional. Though,
now that I write this, I remember having written a Perl program that
checks SFV sums against a given .sfv file. The principle is more or less
the same for checking MD5 sums, or $FOO sums, plus a bit of processing.
I'll see if I can't modify that program to do the sort of thing that
matt wants.
Best Regards,
Christopher Nehren
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)
iD8DBQFCSjllk/lo7zvzJioRAjwYAJ99c7VbvBefbqW2XUHeoD759YxiGQCgs3Z/
+pzROFVhJ3r0dRiwM3sFrpo=
=R79C
-----END PGP SIGNATURE-----
--
I abhor a system designed for the "user", if that word is a coded
pejorative meaning "stupid and unsophisticated". -- Ken Thompson
If you ask the wrong questions, you get answers like "42" and "God".
Unix is user friendly. However, it isn't idiot friendly.
# Matt Kosht:
Perfect job for a shellscript. :)
#!/bin/sh
if [ -z "$2" ]; then
echo "Usage: `basename $0` <file> <file with sums>" 1>&2
exit
fi
sum=`md5 "$1" | sed 's-^MD5 [^=]*= --'`
cnt=`grep -c "$sum" "$2"`
if [ $cnt -eq 0 ]; then
echo "No match."
else
echo "Match."
fi
HTH
Mario
On Wed, 30 Mar 2005 17:55:11 +0200, Mario Hoerich <de> wrote:
>
> Perfect job for a shellscript. :)
>
> #!/bin/sh
>
> if [ -z "$2" ]; then
> echo "Usage: `basename $0` <file> <file with sums>" 1>&2
> exit
> fi
>
> sum=`md5 "$1" | sed 's-^MD5 [^=]*= --'`
> cnt=`grep -c "$sum" "$2"`
>
> if [ $cnt -eq 0 ]; then
> echo "No match."
> else
> echo "Match."
> fi
>
> HTH
> Mario
>[/ref]
Most excellent and appreciated. Works like a champ. Thanks Mario!
Bookmarks