Jun 18, 2004 #1 csunix Programmer Mar 23, 2004 129 GB Does anybody have a script that can be ran against a file that has a list of dictionary words that will add numbers onto the end of these words eg Invent to become Invent12 Friday to become Friday94 Any suggestions would be appreciated. Thanks, CS
Does anybody have a script that can be ran against a file that has a list of dictionary words that will add numbers onto the end of these words eg Invent to become Invent12 Friday to become Friday94 Any suggestions would be appreciated. Thanks, CS
Jun 18, 2004 #2 toolkit Programmer Aug 5, 2001 771 GB In perl: Code: #!/usr/bin/perl -w while(<>) { s/(\w+)/$1 . int(rand(100))/eg; print; } Cheers, Neil Upvote 0 Downvote
Jun 18, 2004 #3 CaKiwi Programmer Apr 8, 2001 1,294 US Or using awk, assuming 1 word per line BEGIN {srand()} { print $1 int(rand()*100) } CaKiwi Upvote 0 Downvote
Jun 18, 2004 #4 RodKnowlton MIS Apr 26, 2000 1,005 Or in Kornshell or Bash, again assuming 1 word per line: Code: while read word do echo "${word}$((${RANDOM} % 100))" done < inwords.txt > outwords.txt I sure hope you're not generating passwords this way. Rod Knowlton IBM Certified Advanced Technical Expert pSeries and AIX 5L Upvote 0 Downvote
Or in Kornshell or Bash, again assuming 1 word per line: Code: while read word do echo "${word}$((${RANDOM} % 100))" done < inwords.txt > outwords.txt I sure hope you're not generating passwords this way. Rod Knowlton IBM Certified Advanced Technical Expert pSeries and AIX 5L