Eliminating duplicate lines

Monty J. Harder mjharder at gmail.com
Sat Dec 24 08:00:53 CST 2005


Oh.  I've used that many times as well.   Like to make a Top Ten list of the
most popular things:
*something | sort | uniq -c | sort -nr | head*


On 12/23/05, Luke-Jr <luke at dashjr.org> wrote:
>
> On Friday 23 December 2005 15:23, Monty J. Harder wrote:
> > On 12/22/05, Luke-Jr <luke at dashjr.org> wrote:
> > > On Friday 23 December 2005 04:35, Jim Herrmann wrote:
> > > > Thanks to Ron also.  This may be easier to remember since it uses
> more
> > > > common commands.
> > >
> > > How is 'sort' and more common than 'uniq'? I really only use the two
> in
> > > combination (uniq -c | sort -n) anyway...
> >
> > That's backwards.  You have to put the *sort* to the left of the *uniq*
> for
> > it to work, because *uniq* requires that its input already be
> sorted.  The
> > beauty of the Unix philosophy is that *uniq* doesn't have to know about
> > sorting, because *sort* already does.
>
> Not quite backwards, read it again-- you're right that it does require
> presorted content, though.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://kclug.org/pipermail/kclug/attachments/20051224/fc8d0443/attachment.htm


More information about the Kclug mailing list