![]() |
adding letters to front and numbers to back of wordlist,bash perl or awk
i would love some help guys, using the following i need upper and lower case letters in the front of the word and 0000-9999 at the end. i did experiment a little but just keep getting errors
perl -e 'while(my $line = <>) { chomp($line); foreach my $i (0000..9999) {printf ("$line%04d\n", $i); }}' pw.txt >> pw2.txt perl -e 'while(my $line = <>) { chomp($line); foreach my $i (A..C,a..c) {printf ("%s$line\n", $i); }}' pw.txt >> pw2.txt i'm also working of making it feed into other programs with | thanks in advance guys! all tips appreciated!!! example aword0000 aword0001 aword0002 bword0000 bword0001 bword0002 im looking for all combinations from single word or word list |
I'm going to assume that you want to do this:
Given a file that contains the following items Code:
FooCode:
0000FooAHere's my solution: Code:
#! /usr/bin/perl |
almost
Quote:
AFoo0000 BBar0001 CBaz0002 thank you very much for the extended script advice! that's the direction its heading in many parts lol. why the 'A' quotes around the A? |
Quote:
'use strict' enforces a number of syntax rules that have to do with how variables and constants are named and/or used. The two things that it typically catches are variables which are not defined with the 'my' or 'our' keywords, and the use of 'barewords', i.e. words which are not variables or keywords which are not quoted. If I had not put quotes around the string constants, I would have gotten the following compile errors: Code:
Bareword "C" not allowed while "strict subs" in use at /tmp/test.pl line 6. |
love the script by the way! i re-edited how the question is asked to explain better what I'm looking for
|
| All times are GMT -5. The time now is 01:50 AM. |