From owner-freebsd-questions@FreeBSD.ORG Sat May 7 06:38:24 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09AE9106564A for ; Sat, 7 May 2011 06:38:24 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3fd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id 806E18FC08 for ; Sat, 7 May 2011 06:38:23 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.187.76.163]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.4/8.14.4) with ESMTP id p476cHGw036705 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sat, 7 May 2011 07:38:18 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk p476cHGw036705 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1304750298; bh=kcnxGjwz5xKz6IVtWXtT49di/4OfNFexrFqDBXqncyE=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4DC4E8D1.5010007@infracaninophile.co.uk>|Date:=20S at,=2007=20May=202011=2007:38:09=20+0100|From:=20Matthew=20Seaman= 20|User-Agent:=20Mozilla/5.0=20(M acintosh=3B=20U=3B=20Intel=20Mac=20OS=20X=2010.6=3B=20en-US=3B=20r v:1.9.2.17)=20Gecko/20110414=20Thunderbird/3.1.10|MIME-Version:=20 1.0|To:=20freebsd-questions@freebsd.org|Subject:=20Re:=20Comparing =20two=20lists|References:=20<4DC48DB6.8030907@lazlarlyricon.com>| In-Reply-To:=20<4DC48DB6.8030907@lazlarlyricon.com>|X-Enigmail-Ver sion:=201.1.1|OpenPGP:=20id=3D60AE908C|Content-Type:=20multipart/s igned=3B=20micalg=3Dpgp-sha1=3B=0D=0A=20protocol=3D"application/pg p-signature"=3B=0D=0A=20boundary=3D"------------enig3A0089035C0A25 1C5F8AFD3B"; b=Omoear9CEs+2OeIVkXaQOUkIJaJV/cJe+t9uKO6cySFjY8ZI9EdU4ohe1FMCMko6w NHF/dbv8SJR2QCwq5JisTOdXTYEhlpscinM4eemNnBAt5pL0Z+qAq0lEZmwR5GovO9 XNclNIO8gebDjHOqvd6bTa6oPtjepeBMYwSXHRiY= Message-ID: <4DC4E8D1.5010007@infracaninophile.co.uk> Date: Sat, 07 May 2011 07:38:09 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4DC48DB6.8030907@lazlarlyricon.com> In-Reply-To: <4DC48DB6.8030907@lazlarlyricon.com> X-Enigmail-Version: 1.1.1 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3A0089035C0A251C5F8AFD3B" X-Virus-Scanned: clamav-milter 0.97 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_FAIL autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lucid-nonsense.infracaninophile.co.uk Subject: Re: Comparing two lists X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2011 06:38:24 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3A0089035C0A251C5F8AFD3B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 07/05/2011 01:09, Rolf Nielsen wrote: > I have two text files, quite extensive ones. They have some lines in > common and some lines are unique to one of the files. The lines that do= > exist in both files are not necessarily in the same location. Now I nee= d > to compare the files and output a list of lines that exist in both > files. Is there a simple way to do this? diff? awk? sed? cmp? Or a > combination of two or more of them? comm(1) Which does exactly what you want -- showing lines that belong to one file or another, and lines that belong to both. The limitation is that the files need to be sorted before being compared. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enig3A0089035C0A251C5F8AFD3B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk3E6NkACgkQ8Mjk52CukIzICACgkkR/29OMXQqmYIVjNxfBp6GZ T1cAni/8iINiby1NDI8VMJL1y0we9bbI =Skjl -----END PGP SIGNATURE----- --------------enig3A0089035C0A251C5F8AFD3B--