Return to Snippet

Revision: 70439
at February 12, 2016 05:31 by http


Initial Code
gawk 'BEGIN {srand(systime() + PROCINFO["pid"])} 
{gsub(/[^[:alpha:]]/," ")
for (i=1;i<=NF;i++) if (length($i)>3) a[++j]=$i}
END{print a[int(j*rand())]}' place-file-here

Initial URL


Initial Description
Allows to take any text file containing numbers and non alphabetic characters and extract a random word from it

Initial Title
Random word from a text file, excluding short non alphabetic charaters

Initial Tags


Initial Language
Awk