LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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
 
LinkBack Search this Thread
Old 02-13-2012, 09:16 AM   #1
sapto
LQ Newbie
 
Registered: Feb 2012
Posts: 8

Rep: Reputation: Disabled
Special alphanumeric wordlist!


can you help me about this???


#!/usr/bin/clisp

(defparameter *character-set* "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
;(defparameter *character-set* "ABC") ; < --- this line is for testing

(defparameter *word-length* 10)
;(defparameter *word-length* 4) ; < --- this line is for testing

(defparameter *character-list*
(coerce *character-set* 'list))

(defun final-char (in-string)
(cond
((> (length in-string) 0)
(elt in-string (1- (length in-string))))
(t
nil)))

(defun new-char-list (in-string)
(let ((result))
(mapcar
(lambda (candidate)
(cond
((not (eql candidate (final-char in-string)))
(push candidate result))))
*character-list*)
(nreverse result))
)

(defun extend-string (in-string desired-length)
(mapcar
(lambda (new-char)
(let ((new-string (concatenate 'string in-string (string new-char))))
(cond
((> (length new-string) desired-length))
((>= (length new-string) desired-length)
(format t "~a~%" new-string))
(t
(extend-string new-string desired-length)))))
(new-char-list in-string)))

(extend-string "" *word-length*)



Is it possible that the program above, changes to: two characters that I wish can't be to each other in word.. example : I don't want that z and y be a neighbors:

abczyab unacceptable
abyzaba unacceptable
abyazab acceptable
 
Old 02-13-2012, 09:47 AM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 332

Rep: Reputation: 118Reputation: 118
you can pipe it to grep
Code:
./yourscript | grep -v -e "yz" -e "zy"
 
Old 02-13-2012, 03:37 PM   #3
sapto
LQ Newbie
 
Registered: Feb 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by millgates View Post
you can pipe it to grep
Code:
./yourscript | grep -v -e "yz" -e "zy"
When I run 2 codes at the same time (./gen.lisp | split -l100000 -d - list &);(./gen.lisp | grep -iv 'zy\|yz' &)
I don't get what I want. I get only the words starting at z and y. Is there a way to start the two codes simultaneously and work well?
 
Old 02-13-2012, 04:29 PM   #4
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 332

Rep: Reputation: 118Reputation: 118
Quote:
Originally Posted by sapto View Post
When I run 2 codes at the same time (./gen.lisp | split -l100000 -d - list &);(./gen.lisp | grep -iv 'zy\|yz' &)
I don't get what I want. I get only the words starting at z and y. Is there a way to start the two codes simultaneously and work well?
Why do you run the script twice? I don't understand what you want to accomplish. Maybe something like

Code:
 ./gen.lisp | grep -v 'zy\|yz' | split -l100000 -d - list
will run the script, remove all lines that contain zy or yz and splits the output into 100MB files
 
Old 02-13-2012, 05:20 PM   #5
sapto
LQ Newbie
 
Registered: Feb 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by millgates View Post
Why do you run the script twice? I don't understand what you want to accomplish. Maybe something like

Code:
 ./gen.lisp | grep -v 'zy\|yz' | split -l100000 -d - list
will run the script, remove all lines that contain zy or yz and splits the output into 100MB files
Thanks a lot. You realy help me. I'm not good at programming. That's why I runed the script 2 times...
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate SPECIAL alphanumeric wordlist!!! Output! sapto Programming 6 02-14-2012 08:08 AM
[SOLVED] Generate SPECIAL alphanumeric WORDLIST - no repeating characters side-by-side Stanley_212 Programming 28 02-13-2012 09:13 PM
Generate SPECIAL alphanumeric WORDLIST with a total amount of consonants, number, ut0ugh1 Programming 2 10-26-2011 02:59 PM
wordlist generator ! noony123 Linux - Newbie 6 10-03-2011 04:13 PM


All times are GMT -5. The time now is 05:25 AM.

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
Open Source Consulting | Domain Registration