2

When I execute a code block in org mode, the output will be tabularized. I want to use this functionality to build a set of commands which I can then execute in a new code block, so I have to remove all pipe characters first. Is there a way to avoid this?

  • May you please provide more detail and an example? – grettke Jan 12 '15 at 22:42
4

We should set an output handling options in header arguments.

We need output type

scalar, verbatim The results should be interpreted literally—they will not be converted into a table. The results will be inserted into the Org mode buffer as quoted text. E.g., :results value verbatim.

and output format

raw The results are interpreted as raw Org mode code and are inserted directly into the buffer. If the results look like a table they will be aligned as such by Org mode. E.g., :results value raw.

Tabular interpretation is enabled by default (with implicit header args):

#+BEGIN_SRC emacs-lisp
(number-sequence 1 5)
#+END_SRC

#+RESULTS:
| 1 | 2 | 3 | 4 | 5 |

To get raw output we need to change :results header argument to verbatim raw:

#+BEGIN_SRC emacs-lisp :results verbatim raw
(number-sequence 1 5)
#+END_SRC

#+RESULTS:
(1 2 3 4 5)

or define that for whole header (or any level):

* Raw output
:PROPERTIES:
:header-args:    :results  verbatim raw
:END:

#+begin_src sh
cat <<EOF
| 1 | 2
|--
| a | b
EOF
#+end_src

#+RESULTS:
| 1 | 2 |
|---+---|
| a | b |

Org-babel provides more ouptut options. You can read about them at Specific Header Arguments and Header arguments and result types in Org Babel.

  • 1
    Thanks. I meanwhile found another solution using :results output – yahan Jan 14 '15 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.