]> nuage.metani.fr Git - 3GPP.git/blobdiff - bin/docx2asn.sh
txt2asn.awk: IE header for constants
[3GPP.git] / bin / docx2asn.sh
index 77d3b3579c691916366c9b66569bc2ec4ae75d48..8a09bb5cdee972128ed03c9118ab1489c493a5b7 100755 (executable)
@@ -47,6 +47,17 @@ while [ "$#" -gt 0 ]; do
            shift
            continue
        fi
            shift
            continue
        fi
+
+       case $platform in
+           # Replace EN-DASH (UTF-8 encoding) at line start with -
+           Linux) LC_ALL=C sed -i $'s/^\u2013/-/g' "${1%.docx}.txt" ;;
+           
+           # Replace EN-DASH (Windows-1252 encoding) at line start with -
+           # Remove CR (0x0d) put by libreoffice in windows before each LF (0x0a)
+           CYGWIN*) LC_ALL=C sed -i $'s/^\x96/-/g; s/\r$//' "${1%.docx}.txt" ;;
+           *) echo "Unkown platform $platform"
+              exit 1;;
+       esac    
     fi
 
     if [[ -e "${1%.docx}.asn" ]] ; then
     fi
 
     if [[ -e "${1%.docx}.asn" ]] ; then
@@ -55,7 +66,7 @@ while [ "$#" -gt 0 ]; do
        continue
     fi
 
        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
     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