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:
In either case, the result ends up in new.txt$ perl -ne '$seen{$_}++; $seen{$_} > 1 and print' old.txt > new.txt
|
|---|