On Mon, 12 Jun 2006 20:39:20 +0200, Alan McKinnon wrote:

> If /etc/hosts has these lines:
> 127.0.0.1 localhost
> 127.0.0.1  localhost
> uniq will see these as different even though they are actually the 
> same entry. So he needs something like tr to squash spaces. This will 
> do it (as root):
> 
> cat /etc/hosts | tr -s ' ' | sort | uniq -i > /etc/hosts.new

sort -u -k1,1 /etc/hosts >/etc/hosts.new

avoids the need to use cat, uniq or tr. -k1,1 sorts on the first field
(space delimited) and -u remove lines where the sort field is the same.


-- 
Neil Bothwick

Please rotate your phone 90 degrees and try again.

Attachment: signature.asc
Description: PGP signature

Reply via email to