Rob Hudson wrote:
> I want to pick a random word from dict/words file, basically pick a
> random line in a file.
$ perl -e '@x=(<>); print $x[int rand @x]' /usr/dict/words
Or, using less memory, ...
$ perl -ne '$l = $_ if ! int rand $n++; END { print $l }' /usr/dict/words
--
Bob Miller K<bob>
kbobsoft software consulting
http://kbobsoft.com [EMAIL PROTECTED]
- [EUG-LUG:2944] random picker Rob Hudson
- [EUG-LUG:2982] Re: random picker Bob Miller
- [EUG-LUG:2982] Re: random picker Rob Hudson
- [EUG-LUG:2987] Re: random picker Bob Miller
