On 12 Dec 11:16, Marc Perkel wrote:
> Thanks in advance for answering my off topic question.
>
> Looking for a simple way to use sort | uniq in a way that returns only
> those lines that are duplicate more and say 3 times. A file like:
>
> one
> two
> two
> three
> three
> three
> four
> four
> four
> four
>
> would return
>
> three
> four
in bash:
$ cat test.txt | sort | uniq -c | while read line; do count=${line% *}; if
[ $count -ge 3 ]; then echo ${line/*$count /}; fi; done
four
three
$
Cheers,
--
Brett Parker http://www.sommitrealweird.co.uk/
PGP Fingerprint 1A9E C066 EDEE 6746 36CB BD7F 479E C24F 95C7 1D61