Re: [exim] Need a little bash scripting help [OT]

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Marc Perkel
Data:  
Para: Brett Parker
CC: exim-users
Asunto: Re: [exim] Need a little bash scripting help [OT]


On 12/12/2010 1:00 PM, Brett Parker wrote:
> 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,


Thanks but I'm getting "too many arguments" on

[ $count -ge 3 ];