From: Justin C on
In article <slrni2f79f.7uc.pm(a)nowster.eternal-september.org>, Paul Martin wrote:
>
> How to cheat at Countdown (aka. Nombres et Chiffres):
>
> #!/bin/sh
> an -w $1 |\
> grep -v "'" |\
> perl -ne 'chomp; printf "%2d %s\n",length($_),$_;'|\
> sort -rn |\
> less

Ya big geek. :)

Justin.

--
Justin C, by the sea.
From: Tom Anderson on
On Fri, 25 Jun 2010, David Cowie wrote:

> Capital letters with curves:
> BCDGJOPQRSU
> Capital letters without curves
> AEFHIKLMNTVWXYZ
> And without slants
> EFHILT
>
> Somewhere on this PC I have a list of the official Scrabble words. If I
> wanted to search it for the longest words using only each set of letters
> above, which Fine Manuals should I be reading?

man grep

I think you want something like:

egrep '^([BCDGJOPQRSU]+|(AEFHIKLMNTVWXYZ)+|(EFHILT)+)$' scrabble-words.txt

Except that only finds you *all* the words using only letters from one
family, not the longest ones. And also, may not work at all.

For a fuller solution, personally, i would turn to a shell script:

man bash
lynx http://tldp.org/LDP/abs/html/

I'd do something like:

for family in BCDGJOPQRSU AEFHIKLMNTVWXYZ EFHILT
do
egrep "^[${family}]+$" scrabble-words.txt | while read word
do
echo "$(echo $word | wc -c) $word"
done | sort -nrk 1 | head -1
done

Of course, you also want:

man wc
man sort
man head

To really understand that.

tom

--
Fitter, Happier, More Productive.