From: David Lecompte Date: Wed, 3 Jun 2026 16:01:31 +0000 (+0100) Subject: Remove CR and EN-Dash X-Git-Url: https://nuage.metani.fr/gitweb/3GPP.git/commitdiff_plain/d788c1f2b3c65a888d59369fdd121ac20da1660b?hp=551b07f4893ca57b9d820c62bbdd2ad3b3660c5c Remove CR and EN-Dash --- diff --git a/bin/docx2asn.sh b/bin/docx2asn.sh index 77d3b35..373abb9 100755 --- a/bin/docx2asn.sh +++ b/bin/docx2asn.sh @@ -47,6 +47,13 @@ while [ "$#" -gt 0 ]; do shift continue fi + + # On windows, soffice adds CR characters at line ends and produces EN-DASH in Windows-1252 enconding, i.e. 0x96 + # Remove the CR at each line end and convert EN-DASH to normal minus + echo "${1%.docx}.txt" + LC_ALL=C sed -i $'s/\x96/-/g' "${1%.docx}.txt" + LC_ALL=C sed -i $'s/\r$//' "${1%.docx}.txt" + fi if [[ -e "${1%.docx}.asn" ]] ; then @@ -55,7 +62,7 @@ while [ "$#" -gt 0 ]; do continue fi - sed -i 's/\r$//' "${1%.docx}.txt" + cat "${1%.docx}.txt" | awk '/^-- ASN1START$/,/^-- ASN1STOP$/' | grep -Evxe '-- ASN1ST(ART|OP)' | grep -v '^--' | awk 'NF || p; { p = NF }' p=0 > "${1%.docx}.asn" if [[ -e "${1%.docx}.asn" ]] ; then