47395Re: sort & remove duplicate lines?
- Feb 2, 2004On Sun, Feb 01, 2004 at 09:13:31PM -0600, Elliott Hoel wrote:
> On Sun, Feb 01, 2004 at 08:57:47PM -0500, Tim Musson wrote:Another option, where nawk is available, is:
> > I use Vim for everything, but find myself going to TextPad for one
> > or 2 things. I was wondering if there is a Vim equivalent?
> > The first one and the one I need most often is "sort & remove
> > duplicate lines". I know I can sort easily with ":n,n!sort", but I
> > don't know how to remove dups. Can anyone point me in the right
> > direction?
> In Unix (I don't know about anything else) sort has the option -u. this
> sorts and removes duplicate lines (man sort): :%!sort -u. Also see the
> alternative command uniq (man uniq), which doesn't sort but removes
> adjacent duplicate lines.
which will remove duplicate lines and doesn't require sorting or
Sun Microsystems Inc.
Austin, TX, USA (TZ=CST6CDT)
GPG PubKey ID:0x7D31DC39, Key server: www.keyserver.net
- << Previous post in topic Next post in topic >>