summaryrefslogtreecommitdiff
path: root/vsvs-map
blob: dbe1ecb4f9a0a23e64926fbdb278723d4853ed1b (plain)
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
#!/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="${res}$(echo -n "${buf}" | $1)"
        fi
        buf="${val}"
    fi
done
if [ -n "${buf}" ]
then
    res="${res}$(echo -n "${buf}" | $1)"
fi
echo -n "${res}"