From: Louis J Scoras Date: 2005-10-06T06:38:03+09:00 Subject: Re: One-liner removing duplicate lines ------=_Part_11074_30095953.1128548280433 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/5/05, Louis J Scoras wrote: > > On 10/5/05, Vincent Foley wrote: > > > > How about the uniq(1) program? uniq infile > outfile > > > Converting from Perl to Ruby, I am trying to find an equivalent to this > > Perl one-liner removing duplicate lines in a file (without sorting it a= t > > first) : > > > He doesn't want sort the file first =3D) > > Actually, to do this strait up unix, you'd need something like this (probably doesn't work perfectly in all cases--play with the sed part at th= e end): $ cat -n input | sort -k2 | uniq -f1 | sort | sed -e 's/^ *[0-9]*\t//' > output ------=_Part_11074_30095953.1128548280433--