Marc Perkel <[email protected]> (Mo 13 Dez 2010 01:15:35 CET):
> > For testing:
> >
> >      <test.txt sort | uniq -c | while read line; do count=${line% *}; echo 
> > "$count : $line"; done
> >
> > But the solution using grep is much more clean.
> >
> > Or try this (it's what I was thinking about when I told you about the -c
> > option on uniq)
> >
> >      <test.txt sort | uniq -c | while read count line; do
> >          [ $count -ge 2 ] &&  echo "$line"
> >      done
> >
> 
> The problem is that I have a space in the data I'm sorting. The code 
> that sets the $count variable includes up to the last space in the string.

Not in my solution, using two variables for the "read".

-- 
Heiko

Attachment: signature.asc
Description: Digital signature

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to