summaryrefslogtreecommitdiffstats
path: root/scripts/awink
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-10-06 19:14:51 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2014-10-06 19:17:03 +0200
commitac2aa1fee5674584c58acfe9c5b47e188582b1ca (patch)
tree97f7fd713608428ba09eef61bac9d745570820e4 /scripts/awink
parent99250cae283c7483373eb5bbc9277137ced7a7ca (diff)
downloadwebsite-ac2aa1fee5674584c58acfe9c5b47e188582b1ca.tar.xz
holy massive dump
Diffstat (limited to 'scripts/awink')
-rwxr-xr-xscripts/awink17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/awink b/scripts/awink
new file mode 100755
index 0000000..d0ad890
--- /dev/null
+++ b/scripts/awink
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+if ! [[ -n "$1" || -n "$2" ]]; then
+ printf "%s\n" "awink <infile> <outfile>"
+ exit 2
+fi
+
+gawk '{
+ if (NF == 2 && $1 == "%include") {
+ while ((getline line < $2) > 0) {
+ print line;
+ }
+ close($2);
+ } else {
+ print;
+ }
+}' "$1" > "$2"