From b548254c6348160c48787164efd5eafab6fa988f Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Tue, 7 Jan 2020 16:41:05 +0000 Subject: remove extra tab from bibsum output --- bibsum | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'bibsum') 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 -- cgit v1.2.3