From owner-freebsd-questions@FreeBSD.ORG Wed Mar 30 15:55:16 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 0D07516A4CE for ; Wed, 30 Mar 2005 15:55:16 +0000 (GMT) Received: from mail.gmx.net (pop.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 04D4443D3F for ; Wed, 30 Mar 2005 15:55:15 +0000 (GMT) (envelope-from m@MHoerich.de) Received: (qmail invoked by alias); 30 Mar 2005 15:55:13 -0000 Received: from pD953CB93.dip.t-dialin.net (EHLO localhost) [217.83.203.147] by mail.gmx.net (mp029) with SMTP; 30 Mar 2005 17:55:13 +0200 X-Authenticated: #5114400 Date: Wed, 30 Mar 2005 17:55:11 +0200 From: Mario Hoerich To: Matt Kosht Message-ID: <20050330155508.GC3218@Pandora.MHoerich.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Y-GMX-Trusted: 0 cc: freebsd-questions@freebsd.org Subject: Re: md5 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2005 15:55:16 -0000 # 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