/ Published in: Awk

Allows to take any text file containing numbers and non alphabetic characters and extract a random word from it
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
Comments
