From owner-freebsd-questions@FreeBSD.ORG Tue Aug 8 15:43:13 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 3DDA516A500 for ; Tue, 8 Aug 2006 15:43:13 +0000 (UTC) (envelope-from david.robillard@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F0BA43D46 for ; Tue, 8 Aug 2006 15:43:12 +0000 (GMT) (envelope-from david.robillard@gmail.com) Received: by ug-out-1314.google.com with SMTP id m2so531643uge for ; Tue, 08 Aug 2006 08:43:11 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=D30+XJpIyzrKGvKpEngt6+X+qq4Rd7B0PSqkjTclCukLFgnUj2y+GTJaKqXXYRIwJGHqen1TsdmcwEAxm9CKmJtnsufVKOg7HS29ar2OrZe2LAQy0EVsXy2uzcgUhDDngCMkvoBr+6qoqXOagcQbfhvNs3butfAAwfeHOX5+ge4= Received: by 10.67.100.12 with SMTP id c12mr9687113ugm; Tue, 08 Aug 2006 08:43:11 -0700 (PDT) Received: by 10.67.28.15 with HTTP; Tue, 8 Aug 2006 08:43:11 -0700 (PDT) Message-ID: <226ae0c60608080843u4facbe83ibefa549f47aba9cb@mail.gmail.com> Date: Tue, 8 Aug 2006 11:43:11 -0400 From: "David Robillard" To: "Odhiambo Washington" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Cc: FreeBSD Questions Mailing List Subject: Re: How to filter the contents of two text files. 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: Tue, 08 Aug 2006 15:43:13 -0000 > 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