From owner-freebsd-questions@FreeBSD.ORG Sat May 7 03:16:02 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 29AD5106564A for ; Sat, 7 May 2011 03:16:02 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 027A18FC0C for ; Sat, 7 May 2011 03:16:01 +0000 (UTC) Received: by pzk27 with SMTP id 27so2206460pzk.13 for ; Fri, 06 May 2011 20:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:date:message-id:subject :from:to:cc:content-type; bh=DOHwd3TT54h6bHh0wL7ZW0cpeDy0XHNgYmuoC+k0vtM=; b=ryWvfKE1r/7Q9/BxsnYCKpazQkgHShmFfgsxhAkXu/nNPF91njsUs0Wr6eE/jyOXG2 3RztsVOsw2kVMci6WAbhRXc8hc/Rwkdzs/QuzkIEkZ6CLJlqc7IukHOzX5waPaDnWHrx 5kSIo+UVQVB7UFfSWdBP+0FdfI6qlnez+JoiM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; b=eQkzkrt/cWNStZFsmkzgPxAhay5NEdoevtV73eHmGs5RyLU6JCBNnUHBc98u8LGN8T Z78LUT0SL3Kx7KHqqKgKwbRfF2et1r94Ts+zchhzxZleZO3JeQP3B+lqrWMiPu6/REKH xflX99W2BJ3p1NdfNpGr+s8CC6stOPwqV2dRk= MIME-Version: 1.0 Received: by 10.68.49.73 with SMTP id s9mr3318264pbn.117.1304738161478; Fri, 06 May 2011 20:16:01 -0700 (PDT) Received: by 10.68.55.136 with HTTP; Fri, 6 May 2011 20:16:01 -0700 (PDT) Date: Fri, 6 May 2011 23:16:01 -0400 Message-ID: From: "b. f." To: Rolf Nielsen Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@FreeBSD.org Subject: Re: Comparing two lists [SOLVED (at least it looks like that)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bf1783@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2011 03:16:02 -0000 > 2011-05-07 02:09, Rolf Nielsen skrev: > > Hello all, > > > > 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? ... > sort file1 file2 | uniq -d If the lines aren't repeated in only one file... For future reference, comm(1) exists to handle problems like this, although (of course) TIMTOWTDI. b.