in reply to Re^3: removing non-duplicates
in thread removing non-duplicates

In the spirit of TMTOWTDI:

$ perl -ne '$seen{$_}++; $seen{$_} == 1 and print' old.txt > new.txt

update: the node title "removing non-duplicates" suggests that lines should be printed only when we know it's a duplicate. To do that:

$ perl -ne '$seen{$_}++; $seen{$_} > 1 and print' old.txt > new.txt
In either case, the result ends up in new.txt
Larry Wall is Yoda: there is no try{}
The Code that can be seen is not the true Code