LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-24-2011, 10:29 PM   #1
enteptain
LQ Newbie
 
Registered: Aug 2011
Location: Louisville,Ky
Distribution: Ubuntu 10.04
Posts: 18

Rep: Reputation: Disabled
Post 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
 
Old 08-24-2011, 11:05 PM   #2
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
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

Last edited by crts; 08-24-2011 at 11:07 PM. Reason: marked changes
 
1 members found this post helpful.
Old 08-24-2011, 11:15 PM   #3
enteptain
LQ Newbie
 
Registered: Aug 2011
Location: Louisville,Ky
Distribution: Ubuntu 10.04
Posts: 18

Original Poster
Rep: Reputation: Disabled
Wink

Quote:
Originally Posted by crts View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sed - change and capitalize some letters in words anascu Linux - Newbie 7 05-10-2011 12:50 PM
[SOLVED] Awk - finding and counting words specific letters within mora978 Programming 9 10-13-2010 10:45 AM
LXer: Simple Arithmetic In Bash, Perl and Awk - More Porting LXer Syndicated Linux News 0 05-28-2008 08:41 AM
Linux Cheat Sheets (awk, ed, sed, bash, screen, perl) pkrumins Linux - Newbie 1 01-31-2008 03:51 PM
Bash - How to make For read lines instead of words in a list ? landuchi Programming 10 02-15-2006 01:36 PM


All times are GMT -5. The time now is 11:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration