0

Some potential duplicates may be the following:

How to ignore specific lines from being redirected

BUT I can't extrapolate from that to solve my problem. So, I am asking here instead.

So, here is what I got so far:

sbcl --noinform --non-interactive --eval "(ql:quickload :lambda-calculus-compiler)" < test.lisp > x.txt

I am trying to evaluate a lisp file, read a text file test.lisp and use it as the input code to (ql:quickload :lambda-calculus-compiler. When loading this a function gets called the reads which will read the contents in test.lisp and then this evaluation will be redirected to x.txt.

Here are the contents of x.txt after this operation:

To load "lambda-calculus-compiler":
  Load 1 ASDF system:
    lambda-calculus-compiler
; Loading "lambda-calculus-compiler"
(((LAMBDA (N) (LAMBDA (M) (LAMBDA (F) (LAMBDA (Z) ((M F) ((N F) Z))))))
  (LAMBDA (F) (LAMBDA (Z) (F (F (F Z))))))
 (LAMBDA (F) (LAMBDA (Z) (F (F (F Z))))))

I want to ignore or get rid of

To load "lambda-calculus-compiler":
  Load 1 ASDF system:
    lambda-calculus-compiler
; Loading "lambda-calculus-compiler"

which is the output of (ql:quickload :lambda-calculus-compiler).

Any help will be appreciated. Please don't mark this a duplicate. As I mentioned I can't extrapolate from answers like the one I linked above.

Thanks.

3
  • 1
    You could pipe through sed '1,/Loading "lambda-calculus-compiler"/ d', which removes the lines starting with 1 through the one containing that phrase. However, that may not be your best option. I'm not familiar with sbcl, but you should read its man page and see if it has options to suppress that output to start with. --noprint or --noinform maybe?
    – frabjous
    May 13, 2022 at 4:30
  • @frabjous can you write an answer please? im not familiar with piping
    – chez93
    May 13, 2022 at 4:41
  • 1
    Pipes are a really basic concept. It's not a shame not to know something - not researching it is.
    – Panki
    May 13, 2022 at 6:23

1 Answer 1

1

One option is to pipe the command through sed before redirecting to the file:

sbcl --noinform --non-interactive --eval "(ql:quickload :lambda-calculus-compiler)" < test.lisp |
  sed '1,/Loading "lambda-calculus-compiler"/ d' > x.txt

This removes the lines starting with 1 through the one after that containing that phrase.

But I suspect there may be other options specific to sbcl as I mentioned in the comments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .