1 |
Teresa and Dale <teendale@×××××××××××××.com> writes: |
2 |
|
3 |
> |
4 |
> |
5 |
> Thanks, read the man page, it was short so it didn't take long. I tried |
6 |
> this: |
7 |
> |
8 |
> uniq -u /home/dale/Desktop/hosts /home/dale/Desktop/hostsort |
9 |
> |
10 |
> It doesn't look like it did anything but copy the same thing over. |
11 |
> There are only 2 lines missing. Does spaces count? Some put in a lot |
12 |
> of spaces between the localhost and the web address. Maybe that has a |
13 |
> affect?? |
14 |
|
15 |
The problem with uniq is that it (according to the manpage), |
16 |
|
17 |
"Discard all but one of successive identical lines" |
18 |
|
19 |
You need to have a sorted file for uniq to do what you want, or sort |
20 |
it with the -u option |
21 |
|
22 |
sort -u hosts > hostsort |
23 |
|
24 |
If you don't want to ruin your original order you have to do something |
25 |
else. This is one way of doing it with perl. |
26 |
|
27 |
perl -ne 'print unless exists $h{$_}; $h{$_} = 1' hosts > hostsort |
28 |
|
29 |
-- |
30 |
Christer |
31 |
|
32 |
-- |
33 |
gentoo-user@g.o mailing list |