From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: [babel] How to kill two birds with one stone? Date: Fri, 25 Feb 2011 17:24:49 -0700 Message-ID: <87zkpjfwew.fsf@gmail.com> References: <808vxv23j2.fsf@missioncriticalit.com> <80mxm9yulk.fsf@missioncriticalit.com> <87sjvj6oul.fsf@gmail.com> <80y654nq9a.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=60106 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt8QJ-0008PD-3l for emacs-orgmode@gnu.org; Fri, 25 Feb 2011 19:54:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pt8QH-0006Eq-LV for emacs-orgmode@gnu.org; Fri, 25 Feb 2011 19:54:14 -0500 Received: from mail-qw0-f41.google.com ([209.85.216.41]:34371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pt8QH-0006Bi-ET for emacs-orgmode@gnu.org; Fri, 25 Feb 2011 19:54:13 -0500 Received: by mail-qw0-f41.google.com with SMTP id 7so2116989qwd.0 for ; Fri, 25 Feb 2011 16:54:13 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.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