LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-11-2011, 10:35 AM   #1
klambo
LQ Newbie
 
Registered: Jul 2011
Location: Ireland
Distribution: backtrack5
Posts: 5

Rep: Reputation: Disabled
how do I edit a clisp scipt to print results to txt


Hello I am looking to edit a great script made and posted by wje_1q Here I would like to be able to save results to a txt file is this possible

#!/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*)

Thanks.

Last edited by klambo; 07-11-2011 at 12:11 PM.
 
Old 07-11-2011, 11:06 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
So what is stopping you?

Please also use [code][/code] tags when submitting code so it is legible.
 
1 members found this post helpful.
Old 07-11-2011, 11:22 AM   #3
klambo
LQ Newbie
 
Registered: Jul 2011
Location: Ireland
Distribution: backtrack5
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by grail View Post
So what is stopping you?

Please also use [code][/code] tags when submitting code so it is legible.
well how do I do that the script runs in terminal window but theres no option to save results to txt file

edit: I changed the title so I dont confuse people,also I AM new to linux

thanks

Last edited by klambo; 07-11-2011 at 11:51 AM.
 
Old 07-11-2011, 12:18 PM   #4
klambo
LQ Newbie
 
Registered: Jul 2011
Location: Ireland
Distribution: backtrack5
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by grail View Post
So what is stopping you?

Please also use [code][/code] tags when submitting code so it is legible.

clisp clisptxt > file.txt

see Im learning
 
Old 07-11-2011, 12:20 PM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,245

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
Good job

You can mark as SOLVED seeing you have a solution
 
1 members found this post helpful.
  


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
Print some results in a text file using script in linux viriimind Linux - Newbie 3 02-28-2011 01:00 PM
Match and Print the results in different files Priyabio Programming 4 08-27-2009 12:09 PM
'find' gives different results when using -mtime with -print vs -exec BrianK Linux - General 1 12-08-2008 11:32 AM
Need Firewall Scipt PLease? extremebfn Linux - Networking 2 09-05-2004 07:23 AM
Results of print job a nightmare loadedmind Linux - Hardware 4 01-04-2004 11:09 PM


All times are GMT -5. The time now is 10:16 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