user8042014
user8042014

Reputation:

Numbering items in word list & reading from lists

I'm writing as script in bash with the purpose of creating characters for purpose of role-playing, and writing. How to i have my script read and randomly select first names from my list (of over 1,000 names)? Also, is there a way that i need to number each entry so that bash will randomly select one word? (Each word is already in its own line.)

Ps: Please just tell me if I'm posting this question on the wrong Stack Exchange site.

Upvotes: 0

Views: 50

Answers (1)

webb
webb

Reputation: 4340

try this:

shuf -n3 names.txt

(selects 3 random names from names.txt)

(source: https://stackoverflow.com/a/15065490)

Upvotes: 0

Related Questions