selecting short words



Hi to all,

i need to extract from a list of words (in a single column) anotherl list containing only the words of 5 or less chars.

I wrote this script, but it doesn't work:

#!/usr/bin/perl -w

while (<>)
{
print "$_" if /^\w{,5}/;
}

someone can tell me why it does not work?

Thanks all,

alladr


|^|_|^|_|^| |^|_|^|_|^|
| | | |
| | | |
| |*\_/*\_/*\_/*\_/*\_/* | |
| |
| |
| |
| http://www.e-allora.net |
| |
| |
**************************************

.



Relevant Pages

  • Re: Extracting Text from the right
    ... >1) To extract to the right of the last "." ... lot or your parsing tasks become more complicated, regular expressions ... shortest 2 chars. ... characters in the string. ...
    (microsoft.public.excel.worksheet.functions)
  • RE: Extracting Text from the right
    ... For the chars to the right of the last ".": ... (The formulas reverse the text and search for the "." ... > Am looking for some help writing an equation to extract from the right of a ... > 1) To extract to the right of the last "." ...
    (microsoft.public.excel.worksheet.functions)
  • extract text between multiple char delimiters rather than a single char
    ... Rather than using cut for example, is it possible and straight forward ... enough to extract text between a given set of chars? ... "I am a string with some words and symbols and it doesn't make much ... What if I want to extract anything between the word "some" as a start ...
    (comp.unix.shell)
  • Re: atoi query
    ... qwe123 and extract the numeric portion, ... Have I misunderstood the strtol function? ... It can't extract a number ... from chars, so it fails. ...
    (comp.lang.c)
  • Re: Need to print 2 chars (or ints) from a string, sugestions?
    ... D54C ... is extract the integer from this string. ... this case can be treated as chars, ...
    (comp.lang.awk)