Sometimes the results from an evaluation aren’t exactly what we want exported to our document. While we could probably change the code, perhaps our point is the code as written.

For example, the shell command, ls -l , pre-pends an initial Total line:

The =ls= command now takes a =time-style= parameter, as in: #+BEGIN_SRC sh ls -lhG --time-style long-iso #+END_SRC #+RESULTS: | total | 5.8M | | | | | | | -rw-rw-r-- | 1 | howard | 6.0K | 2015-09-02 | 17:36 | emacs-init.org | | -rw-rw-r-- | 1 | howard | 22K | 2015-07-05 | 11:13 | eshell-fun.org | | -rw-rw-r-- | 1 | howard | 3.0K | 2015-07-05 | 11:13 | eshell.org | | -rw-rw-r-- | 1 | howard | 4.3K | 2015-09-02 | 12:52 | getting-started2.org | | -rw-rw-r-- | 1 | howard | 5.1K | 2015-03-30 | 18:08 | getting-started.org | ...

This screws up our table. We could change our block to use the tail command, as in:

#+BEGIN_SRC sh ls -lhG --time-style long-iso | tail -n +2 #+END_SRC

However, in this example, I was talking about the ls command, not the tail command. It doesn’t belong.

We can change the output from a code block using the :post parameter, this allows us to have the code block we wish to show, as well as the resulting output.

In this example, to remove the first line, we create a processor code block to return all lines except the first. We specify none to the :exports parameter since I don’t want to have it included in any documents I may export. Notice, the variable, data :

#+NAME: skip_first #+BEGIN_SRC elisp :var data="" :exports none (cdr data) #+END_SRC

Now our code block can contain just the ls -l , but we sent the output to the skip_first block. We assign its data variable to *this* (which refers to our output), and now we only have files:

#+BEGIN_SRC sh :post skip_first(data=*this*) ls -lhG --time-style long-iso #+END_SRC #+RESULTS: | -rw-rw-r-- | 1 | howard | 6.0K | 2015-09-02 | 17:36 | emacs-init.org | | -rw-rw-r-- | 1 | howard | 22K | 2015-07-05 | 11:13 | eshell-fun.org | | -rw-rw-r-- | 1 | howard | 3.0K | 2015-07-05 | 11:13 | eshell.org | | -rw-rw-r-- | 1 | howard | 4.3K | 2015-09-02 | 12:52 | getting-started2.org | | -rw-rw-r-- | 1 | howard | 5.1K | 2015-03-30 | 18:08 | getting-started.org | ...