mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 13:02:51 +00:00
Protected by a new unit test. * lisp/ob-awk.el (org-babel-execute:awk): Use the `org-babel-awk-var-to-awk' function instead of a simple format string.
47 lines
827 B
Org Mode
47 lines
827 B
Org Mode
#+Title: a collection of examples for ob-awk tests
|
|
#+OPTIONS: ^:nil
|
|
|
|
* Simple tests
|
|
:PROPERTIES:
|
|
:ID: 9e998b2a-3581-43fe-b26d-07d3c507b86a
|
|
:END:
|
|
Run without input stream
|
|
#+begin_src awk :ouput silent :results silent
|
|
BEGIN {
|
|
print 42
|
|
}
|
|
#+end_src
|
|
|
|
Use a code block ouput as an input
|
|
#+begin_src awk :stdin genseq :results silent
|
|
{
|
|
print 42+$1
|
|
}
|
|
#+end_src
|
|
|
|
Use input file
|
|
#+name: genfile
|
|
#+begin_src awk :in-file ob-awk-test.in :results silent
|
|
$0~/[\t]*#/{
|
|
# skip comments
|
|
next
|
|
}
|
|
{
|
|
print $1*10
|
|
}
|
|
#+end_src
|
|
|
|
#+name: awk-table-input
|
|
| a | b | c |
|
|
|
|
#+begin_src awk :var a=awk-table-input
|
|
BEGIN{ print a; }
|
|
#+end_src
|
|
|
|
* Input data generators
|
|
A code block to generate input stream
|
|
#+name: genseq
|
|
#+begin_src emacs-lisp :results silent
|
|
(print "1")
|
|
#+end_src
|