Eric Schulte <schulte.e...@gmail.com> writes: > Eric S Fraga <e.fr...@ucl.ac.uk> writes: > >> Eric Schulte <schulte.e...@gmail.com> writes: >> >> [...] >> >>> As an example, I've worked up an very simple ob-awk.el file from >>> ob-template.el, it is attached along with an example org-mode file which >>> demonstrates its usage. >> >> Eric, >> >> this is great to see as I use awk quite often. What is involved in >> extending this to be able to run an awk script on input from within the >> org file (output of another babel block, for instance, as my typical use >> of awk is to re-arrange output from another program...)? Or, if you >> wish, can you suggest one of the ob-XXX modules that best illustrates >> how to do this and I can give it a try? >> > > I've made a quick change so that any variable named "stdin" is treated > specially, in that, rather than using its value to replace strings of > $stdin in the text of the awk code, the value of the stdin variable is > saved into the file processed by awk. This allows awk to operate over > Org-mode references. > > See the attached example file. > > If babel code block supported a pipe or an actual stdin header argument, > that would be the ideal way to add this behavior, but currently nothing > of that nature exists. > > Please let me know if this misses part of your suggestion, or more > generally what else may be advisable before we add this to the core. >
I've now added ob-awk.el to the Org-mode core. The newest version incorporates some change inspired by recent work with Sebastien, notably :stdin is now its own header argument, rather than a special variable name. Best -- Eric -- Eric Schulte http://cs.unm.edu/~eschulte/