LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-30-2009, 03:00 PM   #1
redscorpion69
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Rep: Reputation: 0
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
 
Old 11-30-2009, 04:35 PM   #2
redscorpion69
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
50 views and noone knows?
 
Old 11-30-2009, 04:50 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
Sounds an awful lot like homework.
Try reading these
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
 
0 members found this post helpful.
Old 11-30-2009, 04:53 PM   #4
redscorpion69
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
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...
 
Old 11-30-2009, 04:56 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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.
Old 11-30-2009, 05:01 PM   #6
redscorpion69
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
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.
 
Old 11-30-2009, 05:06 PM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Check out this post of mine for one possible solution.
 
Old 11-30-2009, 05:09 PM   #8
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 164Reputation: 164
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 05:15 PM.
 
Old 11-30-2009, 05:24 PM   #9
redscorpion69
LQ Newbie
 
Registered: Aug 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by rweaver View Post
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.
 
Old 11-30-2009, 06:12 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by redscorpion69 View Post
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.....
 
  


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
How to create permutations for a wordlist ? frenchn00b Programming 5 08-18-2009 06:03 PM
Text file manipulation: alphanumeric strings CHARL0TTE Linux - Newbie 2 07-10-2009 09:40 AM
Why cant the database create a new file with write permissions dappa_don Linux - Server 1 05-28-2009 03:38 AM
Linux shell command for makefile.in to create a text file and write to it alix123 Programming 8 01-07-2005 08:18 AM
create, read and write a table in xml file using C alix123 Programming 1 12-02-2004 12:18 PM


All times are GMT -5. The time now is 04:48 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration