summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]vsvs (renamed from vsvs-map)12
-rwxr-xr-x[-rw-r--r--]vsvs-get25
-rw-r--r--vsvs-sum29
3 files changed, 8 insertions, 58 deletions
diff --git a/vsvs-map b/vsvs
index dbe1ecb..7977ec3 100644..100755
--- a/vsvs-map
+++ b/vsvs
@@ -1,29 +1,31 @@
#!/bin/bash
res=""
buf=""
+key=""
while IFS="" read str
do
if [ -z "${str##* *}" ]
then
- key="${str%% *}"
+ newkey="${str%% *}"
val="${str#* }"
else
- key="${str}"
+ newkey="${str}"
val=""
fi
- if [ -z "${key}" ]
+ if [ -z "${newkey}" ]
then
buf="${buf}"$'\n'"${val}"
else
if [ -n "${buf}" ]
then
- res="${res}$(echo -n "${buf}" | $1)"
+ eval $1
fi
+ key="${newkey}"
buf="${val}"
fi
done
if [ -n "${buf}" ]
then
- res="${res}$(echo -n "${buf}" | $1)"
+ eval $1
fi
echo -n "${res}"
diff --git a/vsvs-get b/vsvs-get
index e7ab391..b3ab53f 100644..100755
--- a/vsvs-get
+++ b/vsvs-get
@@ -1,25 +1,2 @@
#!/bin/bash
-res=""
-met=false
-while IFS="" read str
-do
- if [ -z "${str##* *}" ]
- then
- key="${str%% *}"
- val="${str#* }"
- else
- key="${str}"
- val=""
- fi
- if [ -z "${key}" ] && [ $met == true ]
- then
- res="${res}"$'\n'"${val}"
- elif [ "${key}" == "$1" ]
- then
- met=true
- res="${val}"
- else
- met=false
- fi
-done
-echo -n "${res}"
+vsvs "if [ \"\${key}\" == \"$1\" ]; then res=\"\${buf}\"; fi"
diff --git a/vsvs-sum b/vsvs-sum
deleted file mode 100644
index 1684dd8..0000000
--- a/vsvs-sum
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-res=""
-buf=""
-while IFS="" read str
-do
- if [ -z "${str##* *}" ]
- then
- key="${str%% *}"
- val="${str#* }"
- else
- key="${str}"
- val=""
- fi
- if [ -z "${key}" ]
- then
- buf="${buf}"$'\n'"${val}"
- else
- if [ -n "${buf}" ]
- then
- res="$(echo -n "${buf}" | $1 "${res}")"
- fi
- buf="${val}"
- fi
-done
-if [ -n "${buf}" ]
-then
- res="$(echo -n "${buf}" | $1 "${res}")"
-fi
-echo -n "${res}"