in reply to Removing all non 8 letter words from the dict/words file

Perhaps something like this one-liner :
perl -ne "m/^\w{8}$/ and print" InputfileName
You could redirect STDOUT, if you need to save the file.

     "For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken

Replies are listed 'Best First'.
Re^2: Removing all none 8 letter words from the dict/words file
by xdg (Monsignor) on Apr 09, 2006 at 03:32 UTC

    My initial reaction was that this was going to be less efficient than the length check, but my second reaction is that this ensures that all 8 characters are perl word characters and not hyphens, periods, apostrophes, etc. -- many of which are in the typical dictionary file.

    Checking length == 8 && ! /\A\w{8}\z/ found 2400 entries on my /usr/share/dict/words file.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.