aardvark.code
 
03_simple_example
20160515

Simple example: Hello World

What?

In following example aardvark extracts 3 files from the aardvark.code file: an R-, python- and bash-script. Then the aardvark.sh (the bash script) is executed. The R-script emits 'hello world', which gets capitalized in the Python script.

Prerequisite

For this example you need to have following software installed on your computer:

In a newly created directory (aka folder), put the file aardvark.code, that you can grab like this:

wget http://data.munging.ninja/aardvarkcode/simple_example/aardvark.code 

Here's the content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
##================================================================================
##== generate_data.R
cat ("hello world!")

##================================================================================
##== capitalize.py 
#!/usr/bin/python 

import sys
import string

for line in sys.stdin:
    print string.capwords(line) 

##================================================================================
##== aardvark.sh  
#!/bin/bash
R_EXE="/usr/bin/R --slave --vanilla --quiet"
PY_EXE="/usr/bin/python2"

$R_EXE -f ./generate_data.R | $PY_EXE ./capitalize.py

Execute aardvark. After some housekeeping messages, you'll see:

$ aardvark 
..
..
Hello World!
 
Notes by Data Munging Ninja. Generated on akalumba:sync/20151223_datamungingninja/aardvarkcode at 2018-02-24 12:57