summaryrefslogtreecommitdiff
path: root/bibsum
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2020-01-07 16:41:05 +0000
committerKatolaZ <katolaz@freaknet.org>2020-01-07 16:41:05 +0000
commitb548254c6348160c48787164efd5eafab6fa988f (patch)
tree01a165413e75d9e9bc70ae1beb9c98dbfea9a062 /bibsum
parent8ff32130d3ca8f45aed74e69d1ed297a1605ca8a (diff)
remove extra tab from bibsum output
Diffstat (limited to 'bibsum')
-rwxr-xr-xbibsum12
1 files changed, 8 insertions, 4 deletions
diff --git a/bibsum b/bibsum
index 407e6d5..253d484 100755
--- a/bibsum
+++ b/bibsum
@@ -19,8 +19,12 @@ 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 -aEi "($fields)" | tr '\n' '\t' | sed -E 's/\ +/ /g')
- printf "%s\t%s\t}\n" $name $attrs
+ line=${line##[[:blank:]]}
+ if [ -n "$line" ]; then
+ name=$(echo "$line" | cut -f 1)
+ attrall=$(echo "$line" | cut -f 2-)
+ attrs=$(echo "$line" | tr '\t' '\n' | sort | grep -aEi "($fields)" | \
+ tr '\n' '\t' | sed -E 's/\ +/ /g;s/\t+/\t/g')
+ printf "%s\t%s}\n" $name $attrs
+ fi
done