[sclug] Couple of questions

Spencer Collyer spencer at lasermount.uklinux.net
Sat Oct 25 09:05:34 UTC 2003


On Mon, 03 Mar 2003 14:13:45 +0000, Andy Arbon wrote:
> The other problem:
> 2) I have 2 text files each containing a list of files. (say txt1 and
> txt2). All files in txt1 are also in txt2, but there are files in txt2
> that are not in txt1. I want to be able to separate out the files which
> do not appear in both.. What is the best way?
> 
> Diff doesn't seem to do it (unless there is some weird combination of
> parameters that makes it work?).

A combination of sort and uniq is your friend, like so

	sort txt1 txt2 | uniq -u

The '-u' flag to uniq causes only the unique lines to ibe written to
standard output.

HTH

S>

-- 
<<< Eagles may soar, but weasels don't get sucked into jet engines >>>
2:30pm up 11 days, 16:55, 3 users, load average: 0.19, 0.12, 0.35
Registered Linux User #232457



More information about the Sclug mailing list