From: "Eric Schulte" <schulte.eric@gmail.com>
To: "Sébastien Vauban" <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: [babel] How to kill two birds with one stone?
Date: Fri, 25 Feb 2011 17:24:49 -0700 [thread overview]
Message-ID: <87zkpjfwew.fsf@gmail.com> (raw)
In-Reply-To: 80y654nq9a.fsf@somewhere.org
> * List all files in dir (version of Seb)
>
> Just to show, this code prints a semi-colon after every filename.
>
> #+srcname: graph-files-seb2
> #+begin_src sh :results vector :var dir=graph-dir
> find $dir -type f -print |\
> while read -r name
> do
> echo "\"${name##*/}\";"
> done
> #+end_src
>
> #+results: graph-files-seb2
> | dan | |
> | eric | |
> | other | |
> | "seb | vauban"; |
>
> In most cases, these have been eaten as well...
>
> Is it possible to circumvent this problem, and get my filenames (even those
> with spaces in them) in one column?
>
Hi Seb,
My first idea was to use the ":results list" header argument, to return
a simple list (rather than a table in which the last element has two
columns)
#+begin_src sh :results list
echo "eric schulte"
echo "dan davison"
echo "seb vauban"
#+end_src
#+results:
- ("eric" "schulte")
- ("dan" "davison")
- ("seb" "vauban")
But that didn't work out quite as well as expected. Perhaps list
results should be made "smarter" by concatenating list elements that
happen to be lists themselves into strings...
I then tried the following, which should work, enabling you to split the
raw results on newline in subsequent code blocks. Note this approach
will also preserve things like ";"'s which may have been eaten by org
table import.
#+begin_src sh :results scalar
echo "eric schulte"
echo "dan davison"
echo "seb vauban"
#+end_src
#+results:
: eric schulte
: dan davison
: seb vauban
Hope this helps -- Eric
next prev parent reply other threads:[~2011-02-26 0:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 16:00 [babel] How to kill two birds with one stone? Sébastien Vauban
2011-02-04 17:43 ` Dan Davison
2011-02-04 22:23 ` Sébastien Vauban
2011-02-06 16:51 ` Sébastien Vauban
2011-02-20 8:57 ` Eric Schulte
2011-02-25 14:27 ` Sébastien Vauban
2011-02-25 22:44 ` Nick Dokos
2011-02-25 22:55 ` Nick Dokos
2011-02-28 13:59 ` Sébastien Vauban
2011-02-26 0:24 ` Eric Schulte [this message]
2011-02-26 9:56 ` Closing #+results: with #+end declaration? Bastien
2011-02-27 20:00 ` Eric Schulte
2011-02-28 13:54 ` Sébastien Vauban
2011-03-03 11:11 ` Bastien
2011-02-28 15:16 ` [babel] How to kill two birds with one stone? Sébastien Vauban
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=87zkpjfwew.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=wxhgmqzgwmuf@spammotel.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).