summaryrefslogtreecommitdiff
path: root/vsvs-parse
diff options
context:
space:
mode:
Diffstat (limited to 'vsvs-parse')
-rw-r--r--vsvs-parse17
1 files changed, 17 insertions, 0 deletions
diff --git a/vsvs-parse b/vsvs-parse
new file mode 100644
index 0000000..c06e777
--- /dev/null
+++ b/vsvs-parse
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Iterate action over elements from VSVS input,
+# action is passed as $1, it will be evaluated for each key-value pair.
+after () { test -z "${2##*$1*}" && echo -n "${2#*$1}"; }
+key=""
+value=""
+while IFS="" read line
+do
+ if test -z "${line%% *}"
+ then value="${value}"$'\n'"$(after " " "$line")"
+ else
+ eval $1
+ key="${line%% *}"
+ value="$(after " " "$line")"
+ fi
+done
+eval $1