From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Using Code Blocks in Org Tables Date: Sun, 28 Aug 2011 08:55:59 -0600 Message-ID: <874o11bmpw.fsf@gmail.com> References: <87sjoonrt1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:44979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxgvY-0006jq-Pe for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 11:05:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QxgvX-0000dN-2x for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 11:05:36 -0400 Received: from mail-pz0-f44.google.com ([209.85.210.44]:63499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QxgvW-0000d0-RL for emacs-orgmode@gnu.org; Sun, 28 Aug 2011 11:05:35 -0400 Received: by mail-pz0-f44.google.com with SMTP id 36so8205361pzk.17 for ; Sun, 28 Aug 2011 08:05:34 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Henri-Paul Indiogine Cc: emacs-org Henri-Paul Indiogine writes: > Hi Eric! > > 2011/8/26 Eric Schulte : >> sh code blocks are different in that they don't really have a ":results >> value" option in the same way as most code blocks. =C2=A0Two options wou= ld 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#resu= lts > > 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=3Dstuff echo "$input" |tail -1 #+end_src | one | | two | | 3 | #+TBLFM: @3$1=3D'(sbe last-of-stuff) Hope this helps -- Eric > > Thanks, > Henri-Paul --=20 Eric Schulte http://cs.unm.edu/~eschulte/