]> nuage.metani.fr Git - 3GPP.git/commitdiff
Remove CR and EN-Dash
authorDavid Lecompte <david.lecompte@huawei.com>
Wed, 3 Jun 2026 16:01:31 +0000 (17:01 +0100)
committerDavid Lecompte <david.lecompte@huawei.com>
Wed, 3 Jun 2026 16:01:31 +0000 (17:01 +0100)
bin/docx2asn.sh

index 77d3b3579c691916366c9b66569bc2ec4ae75d48..373abb9c73ef72e8eba644c53348da7cb4a2f88c 100755 (executable)
@@ -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