From owner-freebsd-questions@FreeBSD.ORG Wed Mar 30 18:03:38 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7FCA716A4D0 for ; Wed, 30 Mar 2005 18:03:38 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 224C843D5F for ; Wed, 30 Mar 2005 18:03:37 +0000 (GMT) (envelope-from matt.kosht@gmail.com) Received: by wproxy.gmail.com with SMTP id 69so250928wra for ; Wed, 30 Mar 2005 10:03:37 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=oMVSA5y0aiLmuCfFfLwyLEg354pM9i5KPqMoc7hfBBdY+Fuc502df3P8NHAChtWK/O3AvFSel9R9qyea4JDsWbiJWn7CKpxOH93FTP/VO0+72zUde/xhTdsNxDDYtDT+Z2tII4tKuJqSU4fUz6iLZHkk1GU/9lHd7xc6a/CnyEU= Received: by 10.54.98.2 with SMTP id v2mr169649wrb; Wed, 30 Mar 2005 10:03:37 -0800 (PST) Received: by 10.54.82.5 with HTTP; Wed, 30 Mar 2005 10:03:37 -0800 (PST) Message-ID: Date: Wed, 30 Mar 2005 13:03:37 -0500 From: Matt Kosht To: Mario Hoerich In-Reply-To: <20050330155508.GC3218@Pandora.MHoerich.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit References: <20050330155508.GC3218@Pandora.MHoerich.de> cc: freebsd-questions@freebsd.org Subject: Re: md5 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Matt Kosht List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2005 18:03:38 -0000 On Wed, 30 Mar 2005 17:55:11 +0200, Mario Hoerich wrote: > # 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` " 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 > Most excellent and appreciated. Works like a champ. Thanks Mario!