Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: [OT] Question about duplicate lines in file
Date: Mon, 12 Jun 2006 23:41:07
Message-Id: 20060613002357.2e01866a@hactar.digimed.co.uk
In Reply to: Re: [gentoo-user] Re: [OT] Question about duplicate lines in file by Teresa and Dale
1 On Mon, 12 Jun 2006 17:52:21 -0500, Teresa and Dale wrote:
2
3 > >sort -u -k1,1 /etc/hosts >/etc/hosts.new
4 > >
5 > >avoids the need to use cat, uniq or tr. -k1,1 sorts on the first field
6 > >(space delimited) and -u remove lines where the sort field is the same.
7
8 > Well that removed a few, all of them to be exact. The file was blank.
9 > O_O LOL I'm learning though.
10
11 What's the format of the file? If it's a standard /etc/hosts layout, this
12 will removed duplicates based on IP address, but if you have another
13 field first, you need to change the key.
14
15
16 --
17 Neil Bothwick
18
19 "Bother," said Pooh, as he connected at 300 bps.

Attachments

File name MIME type
signature.asc application/pgp-signature