No need for grep, just use sed's addressing capability

master
Marc Hiatt 2 years ago
parent 9e6860db4c
commit caf75bc4ba
  1. 14
      worddiv

@ -57,21 +57,25 @@ until test "$expression" = "q" ; do
sed "s/expression/$expression/g" > $tmpdir/$secondary_filename
# american
babel_output=$(cd $tmpdir && latex -draftmode $tmpdir/$expression_filename |
grep "\\[\\] .OT1" | sed -E "s/.* ([-a-z]*)$/\1/")
babel_output=$(cd $tmpdir && latex -draftmode $tmpdir/$expression_filename |
# print nothing (sed -n) except the line that matches
# the regexp "/] .OT1/", but only after replacing the
# whole of that line with part of itself, namely last
# glob of letters and hyphens that comes after a space:
sed -nE "/] .OT1/s/.* ([-a-zA-Z]*)$/\1/p")
# british
babel_output_secondary=$(cd $tmpdir && latex -draftmode $tmpdir/$secondary_filename |
grep "\\[\\] .OT1" | sed -E "s/.* ([-a-z]*)$/\1/")
sed -nE "/] .OT1/s/.* ([-a-zA-Z]*)$/\1/p")
## tex+showhyphens
tex_output=$(echo "\showhyphens{$expression}" |
tex -output-directory "$tmpdir" |
sed -nE --posix "/tenrm/s/.* ([-a-z])/\1/p")
sed -nE --posix "/tenrm/s/.* ([-a-zA-Z])/\1/p")
## run comparisons ...
#
# test these by querying the words 'multifacted', 'important', and 'rearranged'
# test these by querying the words 'multifacted', 'important', 'rearranged', and 'Switzerland'
#
# babel AE vs plain TeX
if test "$babel_output" = "$tex_output" ; then

Loading…
Cancel
Save