Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Nov 2014 12:24:41 -0500
From:      Janos Dohanics <web@3dresearch.com>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: uniq(1) on last field
Message-ID:  <20141106122441.bcda9b772b499a6ff0f378d1@3dresearch.com>
In-Reply-To: <C1660725-BF36-4F5F-9BA3-4E0231DB17A0@boosten.org>
References:  <20141106110319.eb34eaa069a4881824072010@3dresearch.com> <C1660725-BF36-4F5F-9BA3-4E0231DB17A0@boosten.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 6 Nov 2014 17:42:40 +0100
Peter Boosten <peter@boosten.org> wrote:

> 
> > 
> > 
> > I would like to use uniq(1) on the file name, which is of course the
> > last field if / is used as field separator. 
> > 
> > How can I tell uniq(1) the "last field" if I have variable number of
> > fields?
> 
> 
> sort -u might be a better option
> 
> -- 
> Peter Boosten

Thanks. I'd have to use something like 'sort -k [n] -u'.

Seems that awk -F "/" '{print NF}' gives the value for n, but what
would be the syntax for that sort command?

-- 
Janos Dohanics



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141106122441.bcda9b772b499a6ff0f378d1>