Awk: generate random sentences
cat /usr/share/dict/words |
grep -v "'" |
shuf |
awk -v wordCount=100 -v wordsPerSentence=5 '
BEGIN {i=0}
(NR<wordCount) {
if (i<wordsPerSentence) {
a[i]=$0;
i++
} else {
for (j=0;j<length(a);j++) {
printf ("%s ",a[j])
}
print
i=0
}
}'
No comments:
Post a Comment