Instead of perl you can use sbcl --noinform --quit --eval .
As for the contents of the script, something like this should work:
(progn (require :cl-ppcre) (let* ((file (nth 4 *posix-argv*)) (buf (make-array (file-length file) :element-type 'character :adjustable t :fill-pointer t))) (setf (fill-pointer buf) (with-open-file (in file) (read-sequence buf in))) (princ (ppcre:regex-replace-all "foo" buf "bar"))))
Or, if you can feed the file line by line:
(progn (require :cl-ppcre) (princ (ppcre:regex-replace-all "foo" (read-line) "bar")))
source share