#! /bin/awk -f # # quote --- convert double quotes to matched pairs of single quotes # # Correctly handles multi-line quotes. # Tries to protect double quotes within equations, but # will probably screw up for multi-line equations with quotes. # # Author: Oscar Nierstrasz @ utcsrgv!oscar 840529 # 881222: fixed handling of umlauts (\") BEGIN { FS = "\"" q[0] = "``" q[1] = "''" j = 0 } /^\.EQ/,/^\.EN/ { print ; next } /^\./ { print ; next } /\"/ { if ($0 ~ /\$/) { n = split ($1, eq, "$") + 1 k = n % 2 printf "%s", $1 for (i=2; i<=NF; i++) { if (k == 0) printf "%s%s", q[j], $i else printf "\"%s", $i j = 1-j n = k + split ($i, eq, "$") + 1 k = n % 2 } printf "\n" } else { for (i=1; i