Jun 18, 2004 #1 csunix Programmer Joined Mar 23, 2004 Messages 129 Location 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 Joined Aug 5, 2001 Messages 771 Location 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 Joined Apr 8, 2001 Messages 1,294 Location 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 Joined Apr 26, 2000 Messages 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