emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Henri-Paul Indiogine <hindiogine@gmail.com>
Cc: emacs-org <emacs-orgmode@gnu.org>
Subject: Re: Using Code Blocks in Org Tables
Date: Sun, 28 Aug 2011 08:55:59 -0600	[thread overview]
Message-ID: <874o11bmpw.fsf@gmail.com> (raw)
In-Reply-To: CAG_r7O4xYFE9zWbVyi0Nwd3mwSR7mrmD-G0m6WgBMYhb4ButpA@mail.gmail.com

Henri-Paul Indiogine <hindiogine@gmail.com> writes:

> Hi Eric!
>
> 2011/8/26 Eric Schulte <schulte.eric@gmail.com>:
>> 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	other threads:[~2011-08-28 15:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26  3:49 Using Code Blocks in Org Tables Henri-Paul Indiogine
2011-08-26 14:58 ` Eric Schulte
2011-08-26 21:35   ` Henri-Paul Indiogine
2011-08-28 14:55     ` Eric Schulte [this message]
2011-08-29  5:38       ` Henri-Paul Indiogine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874o11bmpw.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=hindiogine@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).