emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org babel support for tcl and awk


From: Eric Schulte
Subject: Re: [O] org babel support for tcl and awk
Date: Wed, 25 May 2011 09:57:14 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> * Conclusions
>
> As you can see, I did not really mean any concurrent execution. Simply being
> able to execute parts of code in-situ, in the Org buffer, to document (and
> test) what I'm writing.
>
> And to be able to assemble all the parts in one single script file, by the
> means of literate programming.
>

I see, you want to be able to construct a large pipe chain STDOUT>STDIN,
but you don't care if the parts of the chain (e.g., the code block)
execute in serial or concurrently (as they do in the shell).

The attached patch (can be applied with "git am") implements this
behavior as I understand it.  The result is a new :stdin header argument
with which org-mode references can be passed to shell scripts as
standard input.  Given the technique used in this patch, I'll probably
re-write part of ob-awk.el.

The following Org-mode snippet demonstrates it's use, please let me know
if this works for your use-case described above.

** passing values through to STDIN of shell code blocks
#+results: square-table
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |

#+source: first-col
#+begin_src sh :stdin square-table
  awk '{print $1}'
#+end_src

#+begin_src sh :stdin first-col
  sed 's/4/middle/g'
#+end_src

#+results:
|      1 |
| middle |
|      7 |
Cheers -- Eric

Attachment: 0001-sh-allow-passing-references-through-STDIN-of-a-shell.patch
Description: Text Data

>
> Best regards,
>   Seb

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]