|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello everyone, i am trying to create an ignore list for my
bogofilter. I would like to ignore all words that are less than 4 characters. How can i sort my words list file by length of the words. Thanks. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Sep 7, 9:07 am, joe <jcha...@gmail.com> wrote:
> Hello everyone, i am trying to create an ignore list for my > bogofilter. I would like to ignore all words that are less than 4 > characters. How can i sort my words list file by length of the words. > Thanks. ruby -e 'puts ARGF.sort_by{|w| w.size}' myfile |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
joe <jcharth@gmail.com> wrote:
> Hello everyone, i am trying to create an ignore list for my > bogofilter. I would like to ignore all words that are less than 4 > characters. How can i sort my words list file by length of the words. > Thanks. If you only want to ignore the lines that contain less than four characters, simply use grep: grep '....' words If, however, you need to sort the words by length, here is one solution: awk '{ print $0,length }' words | sort -k2n | awk '{ print $1 }' -- Kenan Kalajdzic |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Thanks Guys, I ended up using cat file|perl -e 'print sort
{ length($b) <=> length($a) } <>' but opted not to use any ignore files. |
|
![]() |
| Outils de la discussion | |
|
|