From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Fps5T-0004GR-H9 for garchives@archives.gentoo.org; Mon, 12 Jun 2006 19:28:35 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.6/8.13.6) with SMTP id k5CJPeDx017325; Mon, 12 Jun 2006 19:25:40 GMT Received: from heisenberg.zen.co.uk (heisenberg.zen.co.uk [212.23.3.141]) by robin.gentoo.org (8.13.6/8.13.6) with ESMTP id k5CJFUs0012111 for ; Mon, 12 Jun 2006 19:15:31 GMT Received: from [82.69.83.178] (helo=desiato.digimed.co.uk) by heisenberg.zen.co.uk with esmtp (Exim 4.30) id 1Fprso-0005WB-Pb for gentoo-user@lists.gentoo.org; Mon, 12 Jun 2006 19:15:30 +0000 Received: from hactar.digimed.co.uk (hactar.digimed.co.uk [192.168.1.2]) by desiato.digimed.co.uk (Postfix) with ESMTP id B4B3B1422019 for ; Mon, 12 Jun 2006 20:15:29 +0100 (BST) Date: Mon, 12 Jun 2006 20:15:26 +0100 From: Neil Bothwick To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Re: [OT] Question about duplicate lines in file Message-ID: <20060612201526.3123e8af@hactar.digimed.co.uk> In-Reply-To: <200606122039.20722.alan@linuxholdings.co.za> References: <448D9974.9030000@vista-express.com> <448DA232.4080809@vista-express.com> <86y7w2qmwh.fsf@poke.chrekh.se> <200606122039.20722.alan@linuxholdings.co.za> Organization: Digital Media Production X-Mailer: Sylpheed-Claws 2.3.0 (GTK+ 2.8.18; x86_64-pc-linux-gnu) X-GPG-Fingerprint: 7260 0F33 97EC 2F1E 7667 FE37 BA6E 1A97 4375 1903 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary=Sig_JVLHMA4sqZBlwZ3Phd2HQ5K; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-Originating-Heisenberg-IP: [82.69.83.178] X-Archives-Salt: 740296cc-aa82-4232-83a5-89c729b53be0 X-Archives-Hash: d3c1e9a3559aaf2ad1e5c987d59adec8 --Sig_JVLHMA4sqZBlwZ3Phd2HQ5K Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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=20 > same entry. So he needs something like tr to squash spaces. This will=20 > do it (as root): >=20 > 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. --=20 Neil Bothwick Please rotate your phone 90 degrees and try again. --Sig_JVLHMA4sqZBlwZ3Phd2HQ5K Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQFEjb1Rum4al0N1GQMRAvmWAKCj5bInSlCFypUyqYWiATdkL0C2nACfWZu7 txa62UVWKWFzfWunZ8/8i/Y= =mW3R -----END PGP SIGNATURE----- --Sig_JVLHMA4sqZBlwZ3Phd2HQ5K-- -- gentoo-user@gentoo.org mailing list