LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   need help adding letters to beginning of words from list using perl,bash or awk (https://www.linuxquestions.org/questions/programming-9/need-help-adding-letters-to-beginning-of-words-from-list-using-perl-bash-or-awk-899293/)

enteptain 08-24-2011 10:29 PM

need help adding letters to beginning of words from list using perl,bash or awk
 
im trying to mod this scrit to put a-z upper and lower case in front of each word in my list.
this is what i've been using to put numbers 1-9999 at the end


perl -e 'while(my $line = <>) { chomp($line); foreach my $i (0000..9999) {printf ("$line%04d\n", $i); }}' wordlist.txt >> wordlistnew.txt

example
Apassword
Bpassword
Cpassword
apassword
bpassword
cpassword


thanks in advance. I'm writing these into a tool

crts 08-24-2011 11:05 PM

Hi and welcome to LQ,

is this what you are looking for:
Code:

perl -e 'while(my $line = <>) { chomp($line); foreach my $i (A..C,a..c) {printf ("%s$line\n", $i); }}' wordlist.txt >> wordlistnew.txt

enteptain 08-24-2011 11:15 PM

Quote:

Originally Posted by crts (Post 4452721)
Hi and welcome to LQ,

is this what you are looking for:
Code:

perl -e 'while(my $line = <>) { chomp($line); foreach my $i (A..C,a..c) {printf ("%s$line\n", $i); }}' wordlist.txt >> wordlistnew.txt

i was so close!! thats perfect. worked like a charm. thank you for this and the welcome. cant wait to do more research here. love the look by title option


All times are GMT -5. The time now is 07:22 PM.