Faustas - Programming, Projects, Psychology and Faust
The following Lisp program loads the lines of a file and checks the length to a specified number of characters. If the length of the line is smaller than the specified *max-string-length*, the line will be send to the standard output. Additionally, you can use shell tools to sort the output and delete entries that are not unique.
The program is as follows:
(defvar *max-string-length* 31)
(defvar *source-file* nil)
(if (FIRST EXT:*ARGS*)
(setq *source-file* (FIRST EXT:*ARGS*)))
(if *source-file*
(with-open-file (stream *source-file* :direction :input
:if-exists :supersede)
(do ((line (read-line stream nil)
(read-line stream nil)))
((null line))
(if (and (< (length line) *max-string-length*) (> (length line) 0))
(format t "~a~%" line)))
))
I stored the code into a file named list_worker.lisp and use it as follows:
clisp list_worker.lisp keywords.csv | sort | uniq > keywords_checked.csv
Good luck.