[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: [babel] How to kill two birds with one stone?
From: |
Eric Schulte |
Subject: |
Re: [Orgmode] Re: [babel] How to kill two birds with one stone? |
Date: |
Fri, 25 Feb 2011 17:24:49 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> * 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
- [Orgmode] [babel] How to kill two birds with one stone?, Sébastien Vauban, 2011/02/04
- [Orgmode] Re: [babel] How to kill two birds with one stone?, Dan Davison, 2011/02/04
- [Orgmode] Re: [babel] How to kill two birds with one stone?, Sébastien Vauban, 2011/02/04
- [Orgmode] Re: [babel] How to kill two birds with one stone?, Sébastien Vauban, 2011/02/06
- Re: [Orgmode] Re: [babel] How to kill two birds with one stone?, Eric Schulte, 2011/02/20
- [Orgmode] Re: [babel] How to kill two birds with one stone?, Sébastien Vauban, 2011/02/25
- Re: [Orgmode] Re: [babel] How to kill two birds with one stone?, Nick Dokos, 2011/02/25
- Re: [Orgmode] Re: [babel] How to kill two birds with one stone?, Nick Dokos, 2011/02/25
- [O] Re: [babel] How to kill two birds with one stone?, Sébastien Vauban, 2011/02/28
- Re: [Orgmode] Re: [babel] How to kill two birds with one stone?,
Eric Schulte <=
- [Orgmode] Closing #+results: with #+end declaration?, Bastien, 2011/02/26
- [Orgmode] Re: Closing #+results: with #+end declaration?, Eric Schulte, 2011/02/27
- [O] Re: Closing #+results: with #+end declaration?, Sébastien Vauban, 2011/02/28
- [O] Re: [babel] How to kill two birds with one stone?, Sébastien Vauban, 2011/02/28