emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Loris Bennett" <loris.bennett@fu-berlin.de>
To: emacs-orgmode@gnu.org
Subject: Re: Creating hline in table from source block?
Date: Tue, 26 Nov 2013 09:05:40 +0100	[thread overview]
Message-ID: <87pppnoaej.fsf@hornfels.zedat.fu-berlin.de> (raw)
In-Reply-To: 8738mjdguk.fsf@gmail.com

Eric Schulte <schulte.eric@gmail.com> writes:

> "Loris Bennett" <loris.bennett@fu-berlin.de> 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.

  reply	other threads:[~2013-11-26  8:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 10:52 Creating hline in table from source block? Loris Bennett
2013-11-25 20:13 ` Achim Gratz
2013-11-25 20:43   ` Achim Gratz
2013-11-26 16:40     ` Daniel E. Doherty
2013-11-25 21:38 ` Rasmus
2013-11-26  0:47   ` Rasmus
2013-11-26  2:41 ` Eric Schulte
2013-11-26  8:05   ` Loris Bennett [this message]
2013-11-26  8:54     ` Rasmus
2013-11-26 13:14     ` Eric Schulte
2013-11-26 14:23       ` Loris Bennett
2013-11-26 20:07         ` Achim Gratz

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=87pppnoaej.fsf@hornfels.zedat.fu-berlin.de \
    --to=loris.bennett@fu-berlin.de \
    --cc=emacs-orgmode@gnu.org \
    /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).