uniq(1) on last field

Janos Dohanics web at 3dresearch.com
Thu Nov 6 17:27:54 UTC 2014


On Thu, 6 Nov 2014 17:42:40 +0100
Peter Boosten <peter at 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


More information about the freebsd-questions mailing list