Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 May 2011 07:38:09 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: Comparing two lists
Message-ID:  <4DC4E8D1.5010007@infracaninophile.co.uk>
In-Reply-To: <4DC48DB6.8030907@lazlarlyricon.com>
References:  <4DC48DB6.8030907@lazlarlyricon.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
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--



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?4DC4E8D1.5010007>