Date: Wed, 30 Mar 2005 17:55:11 +0200 From: Mario Hoerich <lists@MHoerich.de> To: Matt Kosht <matt.kosht@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: md5 Message-ID: <20050330155508.GC3218@Pandora.MHoerich.de> In-Reply-To: <a87eda32050329192919ed1f08@mail.gmail.com> References: <a87eda32050329192919ed1f08@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
# Matt Kosht:
> 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?
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050330155508.GC3218>
