ref: cb8d0756a245a61662c8bc63dd0c054c7e0dfdb3
parent: f461b5b3c1d59712d376e308e28972b19ee9321a
author: qwx <qwx@sciops.net>
date: Wed Sep 22 08:23:48 EDT 2021
sm2geradd: don't add a tab on additional records transform $0, and move it after the other pattern so it doesn't match both actions
--- a/bin/sm2geradd
+++ b/bin/sm2geradd
@@ -1,9 +1,5 @@
#!/bin/rc
awk -F' +' -v 'p=/usr/qwx/p/sm2/ger' -v 'dict=/usr/qwx/p/sm2/ger/db' '
-$1 == ""{
- print "\n" $0 >>last
- close(last)
-}
$1 != ""{
f = $1
gsub("[\\[\\(,]+.*", "", f)
@@ -15,6 +11,11 @@
else
print "2.5 0 0 0 " f ".pdf" >>dict
printf "%s\n.Bp\n%s\n\n%s\n", h, $1, $2 >>last
+ close(last)
+}
+$1 == "" && NF > 1{
+ sub("^ ", "")
+ printf "\n%s\n", $0 >>last
close(last)
}
' $*