Merge branch 'maint'
[org-mode.git] / testing / examples / ob-awk-test.org
blob63e070ff820d953f3a6e6d803eec7e0c31ee0c0f
1 #+Title: a collection of examples for ob-awk tests
2 #+OPTIONS: ^:nil
4 * Simple tests
5   :PROPERTIES:
6   :ID:       9e998b2a-3581-43fe-b26d-07d3c507b86a
7   :END:
8 Run without input stream
9 #+begin_src awk :ouput silent :results silent
10   BEGIN {
11       print 42
12   }
13 #+end_src
15 Use a code block ouput as an input
16 #+begin_src awk  :stdin genseq :results silent
17   {
18       print 42+$1
19   }
20 #+end_src
22 Use input file
23 #+name: genfile
24 #+begin_src awk  :in-file ob-awk-test.in :results silent
25     $0~/[\t]*#/{
26         # skip comments 
27         next
28     }
29     { 
30         print $1*10
31     }
32 #+end_src
34 #+name: awk-table-input
35 | a | b | c |
37 #+begin_src awk :var a=awk-table-input
38   BEGIN{ print a; }
39 #+end_src
41 * Input data generators
42 A code block to generate input stream
43 #+name: genseq
44 #+begin_src emacs-lisp :results silent
45 (print "1")
46 #+end_src