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

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

@ -58,20 +58,24 @@ until test "$expression" = "q" ; do
# american # american
babel_output=$(cd $tmpdir && latex -draftmode $tmpdir/$expression_filename | babel_output=$(cd $tmpdir && latex -draftmode $tmpdir/$expression_filename |
grep "\\[\\] .OT1" | sed -E "s/.* ([-a-z]*)$/\1/") # 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 # british
babel_output_secondary=$(cd $tmpdir && latex -draftmode $tmpdir/$secondary_filename | 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+showhyphens
tex_output=$(echo "\showhyphens{$expression}" | tex_output=$(echo "\showhyphens{$expression}" |
tex -output-directory "$tmpdir" | 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 ... ## 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 # babel AE vs plain TeX
if test "$babel_output" = "$tex_output" ; then if test "$babel_output" = "$tex_output" ; then

Loading…
Cancel
Save