emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Using Code Blocks in Org Tables


From: Eric Schulte
Subject: Re: [O] Using Code Blocks in Org Tables
Date: Sun, 28 Aug 2011 08:55:59 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Henri-Paul Indiogine <address@hidden> writes:

> Hi Eric!
>
> 2011/8/26 Eric Schulte <address@hidden>:
>> sh code blocks are different in that they don't really have a ":results
>> value" option in the same way as most code blocks.  Two options would be
>> to either
>> 1. remove the "echo $HOME" line from your code blocks, or
>> 2. change the '(sbe "test-sh") formula to '(second (second (sbe "test-sh")))
>
> I was going by: http://orgmode.org/worg/org-contrib/babel/intro.html#results
>
> Capturing the results of code evaluation.
> The 'result' of code evaluation is the value of the last statement in
> the code block. ....
>
> I have a long bash script that outputs a lot of information to a log
> file.   But I would like one piece of information to end up in a cell
> of an org-mode table.   I can place this value as the last one in the
> bash script.  How could I make that work?
>

Hi Henri-Paul,

You could define another code block which could be used to take just the
last line of the output, e.g.,

#+source: stuff
#+begin_src sh
  echo 1
  echo 2
  echo 3
#+end_src

#+source: last-of-stuff
#+begin_src sh :var input=stuff
  echo "$input" |tail -1
#+end_src

| one |
| two |
| 3   |
#+TBLFM: @3$1='(sbe last-of-stuff)

Hope this helps -- Eric

>
> Thanks,
> Henri-Paul

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]