LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 09: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 11:11 AM.
 
Old 07-11-2011, 10:06 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
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, 10: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 10:51 AM.
 
Old 07-11-2011, 11:18 AM   #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, 11:20 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
Good job

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:47 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
Open Source Consulting | Domain Registration