in reply to Removing duplicate lines from files (was 'Files')
We all know that TIMTOWTDY, but do all the ways have to have something to do with Perl?
If the order of the addresses is irrelevant, and assuming that the file consists of one address per line, I'd use sort (1).
sort -u -o address_file.txt address_file.txt
When the only tool one has at hand is a hammer,
one tends to believe every problem is a nail.
And I confess that this saying applies to me all too often
;-)
--bwana147
Update: I hadn't seen perlplexer's contribution. It might be interesting to note that uniq works only if duplicate lines follow each other. It won't work if duplicates are scattered across the file. In such a case, you'll have to sort the file first, and pipe the sorted output into uniq, which is exactly what sort -u does.
My € 0.02
|
|---|