Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-30-2009, 04:00 PM
|
#1
|
LQ Newbie
Registered: Aug 2009
Posts: 12
Rep:
|
How to create alphanumeric permutations and write to file
Hello, I know nothing about writing scripts in linux so maybe you could help me.
How would i go about writing permutations of letters [a-z] and numbers [0-9] of size 8 and store it in the text file? Furthermore the combination must not contain more than two of the same character in a row. So, aabb1125, or 12345678 is fine, while 23zzzart would not be valid.
Can i do this directly from cli, and if so how?
Thx
|
|
|
11-30-2009, 05:35 PM
|
#2
|
LQ Newbie
Registered: Aug 2009
Posts: 12
Original Poster
Rep:
|
50 views and noone knows?
|
|
|
11-30-2009, 05:50 PM
|
#3
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,417
|
|
|
0 members found this post helpful.
|
11-30-2009, 05:53 PM
|
#4
|
LQ Newbie
Registered: Aug 2009
Posts: 12
Original Poster
Rep:
|
Ouch that's a lot of stuff i don't have time to go over atm.
I was hopping for a quick solution.
Btw i wish i was that young...
|
|
|
11-30-2009, 05:56 PM
|
#5
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,417
|
See the LQ rules about homework http://www.linuxquestions.org/linux/rules.html
You don't need to read all the stuff at those links, but will need to reference/search them for techniques to solve your problem; the actual soln will be fairly short.
Try something and show us your code if you get stuck.
We will help you solve your problem, but we won't do your h/w for you.
As someone said, a hand-up, not a hand-out.
|
|
0 members found this post helpful.
|
11-30-2009, 06:01 PM
|
#6
|
LQ Newbie
Registered: Aug 2009
Posts: 12
Original Poster
Rep:
|
Why do you keep mentioning h/w?! How is my post different than many other in here? I know about those and many other links but i was hopping someone would give me a hand here.
In any case, 6 posts with no info.
|
|
|
11-30-2009, 06:06 PM
|
#7
|
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187
|
Check out this post of mine for one possible solution.
|
|
|
11-30-2009, 06:09 PM
|
#8
|
Senior Member
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833
Rep:
|
The reason why is a lot of us have been at school and been given that exact or nearly exact question, there aren't a lot of functional uses for data like that like other than homework.
As suggested by the previous poster give us some code and if you don't figure it out right away we'll help you get through it...
or describe what you're doing so we understand that this isn't something being used to skip past a homework assignment or for a nefarious purpose (this kind of output would be useful for example brute forcing a password of known length as a dictionary, and generation rules.)
Age has little to do with it being homework, as many 50 year olds ask for help with homework or for help on something they don't understand as 13 year olds, people goto school at all ages these days
Last edited by rweaver; 11-30-2009 at 06:15 PM.
|
|
|
11-30-2009, 06:24 PM
|
#9
|
LQ Newbie
Registered: Aug 2009
Posts: 12
Original Poster
Rep:
|
Quote:
Originally Posted by rweaver
As suggested by the previous poster give us some code and if you don't figure it out right away we'll help you get through it...
or describe what you're doing so we understand that this isn't something being used to skip past a homework assignment or for a nefarious purpose (this kind of output would be useful for example brute forcing a password of known length as a dictionary, and generation rules.)
|
This is exactly why i need it, though it is not for nefarious purpose as i am trying to test some security solutions i do for job as a network engineer. The automated process was done with windows; since we moved away to linux/freeBSD i am trying to relearn the steps i took for granted.
Still that link above looks promising, thx.
|
|
|
11-30-2009, 07:12 PM
|
#10
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by redscorpion69
Ouch that's a lot of stuff i don't have time to go over atm.
I was hopping for a quick solution.
Btw i wish i was that young...
|
You'll need to generate random numbers using something like $RANDOM
You'll need to convert the random numbers to the right range using %
You'll need something like printf to get ascii characters from the numbers
You'll need to set up tests for disallowed combinations.
.
.
.
Quick? NO
Easy? Maybe
Straightforward? Yes
I got hung up trying the remember all the syntax of printf---eg:
printf \\141 gives "a" (141 being the octal value)----if only something like $RANDOM would work in octal.....
|
|
|
All times are GMT -5. The time now is 01:57 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|