Just a quickie on a quickie from Grant Rettke. The quickie is an example from Rettke on how to import and use a table in an Org code block using shell. The secret is that the table entries get passed in as arguments to the command specified in the shell block.
That’s good to know but Rettke’s example raised two questions for me. The first is what would happen if the table data had more than a single column. The answer is that it does just what you’d think it should. I reran Rettke’s example with the table
#+name: data | 1 | a | | 2 | b | | 3 | c | | 4 | d |
and got the results
#+RESULTS: code #+begin_EXAMPLE 1 a 2 b 3 c 4 d #+end_EXAMPLE
The second question was how he got his results wrapped with the #+begin_EXAMPLE
, #+end_EXAMPLE
delimiters. I thought that maybe he put the #+RESULT: code
in between those delimiters but that didn’t work. The only way I could see to do it was to use the :wrap
keyword in the header arguments:
#+begin_src sh :var arg=data :results output :wrap EXAMPLE
Perhaps Rettke will drop by and share his secrets with us. In the meantime, if you want to deal with a table in a shell code block, this is how to do it.