summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2020-01-05 16:34:01 +0000
committerKatolaZ <katolaz@freaknet.org>2020-01-05 16:34:01 +0000
commitd81569bf126d1de0e6da4c32bc0e2b9ee460b78a (patch)
treeea9b1c915dd10251c1931cc9d70ddc944e73d0c7
parent879a7f0eb3393778a2a37aa1bee8cbd16f61814f (diff)
bibsum: fix field-matching regexp
-rwxr-xr-xbibsum6
1 files changed, 3 insertions, 3 deletions
diff --git a/bibsum b/bibsum
index 8e59e54..6ac7a43 100755
--- a/bibsum
+++ b/bibsum
@@ -10,10 +10,10 @@ if [ $# -lt 1 ]; then
exit 1;
fi
-fields=$(echo "$@" | sed -E 's/([a-zA-Z0-9]+)/\1.\*=|/g;s/\ //g')
+fields=$(echo "$@" | sed -E 's/([a-zA-Z0-9]+)/^\[\[:blank:\]\]*\1.\*=|/g;s/\ //g')
fields=$(echo "$fields" | sed -E 's/\|$//')
-##echo "$fields"
+echo "$fields"
IFS='
'
@@ -21,6 +21,6 @@ IFS='
while read -r line; do
name=$(echo "$line" | cut -f 1)
attrall=$(echo "$line" | cut -f 2-)
- attrs=$(echo "$line" | tr '\t' '\n' | sort | grep -E -ai "($fields)" | tr '\n' '\t' | sed -E 's/\ +/ /g')
+ attrs=$(echo "$line" | tr '\t' '\n' | sort | grep -aEi "($fields)" | tr '\n' '\t' | sed -E 's/\ +/ /g')
printf "%s\t%s\t}\n" $name $attrs
done