Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 May 2011 13:02:06 +0200
From:      Rolf Nielsen <listreader@lazlarlyricon.com>
To:        bf1783@gmail.com
Cc:        "b. f." <bf1783@googlemail.com>, freebsd-questions@FreeBSD.org
Subject:   Re: Comparing two lists [SOLVED (at least it looks like that)]
Message-ID:  <4DC526AE.3080603@lazlarlyricon.com>
In-Reply-To: <BANLkTi=52xJMWt-=3-LgCEOR_b2e5J3jEg@mail.gmail.com>
References:  <BANLkTi=52xJMWt-=3-LgCEOR_b2e5J3jEg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2011-05-07 05:16, b. f. skrev:
>> 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...

They aren't (see my reply to Yuri Pankov). :)

>
> For future reference, comm(1) exists to handle problems like this,
> although (of course) TIMTOWTDI.
>
> b.
>




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