blob: f33ea3d5b9c66b03ca1531eb5b613f6a2d1e3af3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/sh
tag_name=$1
filename=$2
output=$(grep -Poh "^\[meta\]:\s+<$tag_name>\s+\(\K(.+)(?=\)$)" $filename)
if [[ $tag_name = "tags" ]]; then
echo $output |\
sed "s/,\s*/\n/g" |\
sed -z '$ s/\n$//' |\
jq --raw-input --slurp 'split("\n")'
else
echo $output |\
sed -z '$ s/\n$//' |\
jq --raw-input
fi
|