From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Loris Bennett" Subject: Re: Creating hline in table from source block? Date: Tue, 26 Nov 2013 09:05:40 +0100 Message-ID: <87pppnoaej.fsf@hornfels.zedat.fu-berlin.de> References: <8738mkiwhx.fsf@hornfels.zedat.fu-berlin.de> <8738mjdguk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlDeh-0000tG-VB for emacs-orgmode@gnu.org; Tue, 26 Nov 2013 03:06:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlDea-0001an-4y for emacs-orgmode@gnu.org; Tue, 26 Nov 2013 03:05:59 -0500 Received: from plane.gmane.org ([80.91.229.3]:39136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlDeZ-0001ad-Ux for emacs-orgmode@gnu.org; Tue, 26 Nov 2013 03:05:52 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VlDeZ-0003eC-0R for emacs-orgmode@gnu.org; Tue, 26 Nov 2013 09:05:51 +0100 Received: from hornfels.zedat.fu-berlin.de ([160.45.11.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Nov 2013 09:05:51 +0100 Received: from loris.bennett by hornfels.zedat.fu-berlin.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 26 Nov 2013 09:05:51 +0100 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: emacs-orgmode@gnu.org Eric Schulte writes: > "Loris Bennett" writes: > >> Dear List, >> >> This >> >> #+BEGIN_SRC sh >> echo "a b c d" >> echo "1 2 3 4" >> echo "5 6 7 8" >> #+END_SRC >> >> produces this: >> >> #+RESULTS: >> | a | b | c | d | >> | 1 | 2 | 3 | 4 | >> | 5 | 6 | 7 | 8 | >> >> How do I get this >> >> #+RESULTS: >> | a | b | c | d | >> |-----+---+---+---| >> | 1 | 2 | 3 | 4 | >> | 5 | 6 | 7 | 8 | >> >> ? >> > > Most easily done with an Emacs Lisp code block. > > #+BEGIN_SRC emacs-lisp > '((a b c d) > hline > (1 2 3 4) > (5 6 7 8)) > #+END_SRC > > #+RESULTS: > | a | b | c | d | > |---+---+---+---| > | 1 | 2 | 3 | 4 | > | 5 | 6 | 7 | 8 | Oops, my example was obviously a little too simple. What I am actually doing is something like this: #+NAME: current_data #+BEGIN_SRC sh :dir /home/loris/remote/far/far/away/results echo "step level time clicks" grep statistics *.log | awk '{print $(NF-9),"\t",$(NF-6),"\t",$(NF-4),"\t",$(NF-1)}' #+END_SRC So Achim's suggestion of using ":results raw" might be the way to go (once I've worked out what the sed bit is doing ...) However, the table will ultimately be around 40000 lines long, so from a performance point of view it would be nice not to have to pipe the whole thing through sed, particularly as the files are on a remote server. Having said that though, it is not a performance-critical application. So maybe I'll look at Rasmus' simpler suggestion (my lisp skill are unfortunately not quite up to the "fun" variant ...) How complex would the elisp version of my grep and awk above be? Just having one code block would be a little neater from my point of view. Thanks for all the help. Cheers, Loris -- This signature is currently under construction.