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 1FpvR2-0005g7-Sj for garchives@archives.gentoo.org; Mon, 12 Jun 2006 23:03:05 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.6/8.13.6) with SMTP id k5CN10Fr026799; Mon, 12 Jun 2006 23:01:00 GMT Received: from mxo2.broadbandsupport.net (mxo2.broadbandsupport.net [209.55.3.82]) by robin.gentoo.org (8.13.6/8.13.6) with ESMTP id k5CMqNU2027387 for ; Mon, 12 Jun 2006 22:52:24 GMT Received: from [192.168.100.4] (unknown [207.68.230.60]) by mxo2.broadbandsupport.net (Postfix) with ESMTP id D912F348B1B for ; Mon, 12 Jun 2006 16:52:21 -0600 (MDT) Message-ID: <448DF025.4010600@vista-express.com> Date: Mon, 12 Jun 2006 17:52:21 -0500 From: Teresa and Dale User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060518 X-Accept-Language: en-us, en 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 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Re: [OT] Question about duplicate lines in file References: <448D9974.9030000@vista-express.com> <448DA232.4080809@vista-express.com> <86y7w2qmwh.fsf@poke.chrekh.se> <200606122039.20722.alan@linuxholdings.co.za> <20060612201526.3123e8af@hactar.digimed.co.uk> In-Reply-To: <20060612201526.3123e8af@hactar.digimed.co.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-broadbandsupport.net-MailScanner-Information: Please contact the ISP for more information X-broadbandsupport.net-MailScanner: Found to be clean X-broadbandsupport.net-MailScanner-From: teendale@vista-express.com X-Spam-Status: No X-Archives-Salt: 838979b6-94d7-4708-bbc9-43cd9c802841 X-Archives-Hash: d874b4dc0339a4b5cf1528330ab331df Neil Bothwick wrote: >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. > > > > Well that removed a few, all of them to be exact. The file was blank. O_O LOL I'm learning though. Dale :-) -- gentoo-user@gentoo.org mailing list