Skip site navigation (1)Skip section navigation (2)
Date:      7 May 2011 02:43:42 -0000
From:      "John Levine" <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Comparing two lists
Message-ID:  <20110507024342.98559.qmail@joyce.lan>
In-Reply-To: <4DC49CC3.8000103@lazlarlyricon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>Some 10,000 to 20,000 lines each. I do need only the common lines. Order 
>is not essential, but would make life easier. I've tried a little with 
>uniq, as suggested by Polyptron, but I guess 3am is not quite the right 
>time to do these things. Anyway, thanks.

 sort -u file1 > sorted-file1
 sort -u file2 > sorted-file2
 comm -12 sorted-file1 sorted-file2 > result

R's,
John




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