File: ob-awk-test.org

package info (click to toggle)
org-mode 9.1.14%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,884 kB
  • sloc: lisp: 142,310; xml: 1,055; makefile: 197; ansic: 14; sh: 5
file content (46 lines) | stat: -rw-r--r-- 827 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#+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