diff options
author | KatolaZ <katolaz@freaknet.org> | 2020-01-07 16:41:05 +0000 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2020-01-07 16:41:05 +0000 |
commit | b548254c6348160c48787164efd5eafab6fa988f (patch) | |
tree | 01a165413e75d9e9bc70ae1beb9c98dbfea9a062 /bibsum | |
parent | 8ff32130d3ca8f45aed74e69d1ed297a1605ca8a (diff) |
remove extra tab from bibsum output
Diffstat (limited to 'bibsum')
-rwxr-xr-x | bibsum | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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 |