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>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
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 need
> 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

-- 
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


[-- Attachment #2 --]
-----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-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4DC4E8D1.5010007>