Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Aug 2006 11:43:11 -0400
From:      "David Robillard" <david.robillard@gmail.com>
To:        "Odhiambo Washington" <wash@wananchi.com>
Cc:        FreeBSD Questions Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: How to filter the contents of two text files.
Message-ID:  <226ae0c60608080843u4facbe83ibefa549f47aba9cb@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
> Some little help is needed here ...
>
> I have two text files, each has just a single column of data
>
> FileA has 2798 entries, while FileB has 4242 entries; There are
> entries in FileA that are also in FileB...
>
> I'd like to filter against the two files, so I only get those entries
> in FileB that don't occur only in FileA ....

There are a couple of commands to do exactly what you want.

comm(1) -- select or reject lines common to two files
http://www.freebsd.org/cgi/man.cgi?query=comm&apropos=0&sektion=0&manpath=FreeBSD+6.1-RELEASE&format=html

diff(1) -- find differences between two files
http://www.freebsd.org/cgi/man.cgi?query=diff&apropos=0&sektion=0&manpath=FreeBSD+6.1-RELEASE&format=html

sort(1) -- sort lines of text files
http://www.freebsd.org/cgi/man.cgi?query=sort&apropos=0&sektion=0&manpath=FreeBSD+6.1-RELEASE&format=html

Enjoy!

DA+
-- 
David Robillard
UNIX systems administrator & Oracle DBA
CISSP, RHCE & Sun Certified Security Administrator
Montreal: +1 514 966 0122



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