1 |
Neil Bothwick wrote: |
2 |
|
3 |
>On Mon, 12 Jun 2006 20:39:20 +0200, Alan McKinnon wrote: |
4 |
> |
5 |
> |
6 |
> |
7 |
>>If /etc/hosts has these lines: |
8 |
>>127.0.0.1 localhost |
9 |
>>127.0.0.1 localhost |
10 |
>>uniq will see these as different even though they are actually the |
11 |
>>same entry. So he needs something like tr to squash spaces. This will |
12 |
>>do it (as root): |
13 |
>> |
14 |
>>cat /etc/hosts | tr -s ' ' | sort | uniq -i > /etc/hosts.new |
15 |
>> |
16 |
>> |
17 |
> |
18 |
>sort -u -k1,1 /etc/hosts >/etc/hosts.new |
19 |
> |
20 |
>avoids the need to use cat, uniq or tr. -k1,1 sorts on the first field |
21 |
>(space delimited) and -u remove lines where the sort field is the same. |
22 |
> |
23 |
> |
24 |
> |
25 |
> |
26 |
|
27 |
Well that removed a few, all of them to be exact. The file was blank. |
28 |
O_O LOL I'm learning though. |
29 |
|
30 |
Dale |
31 |
:-) |
32 |
-- |
33 |
gentoo-user@g.o mailing list |