]> nuage.metani.fr Git - 3GPP.git/blobdiff - bin/38331-convert.sh
asn1-split.awk does not add new lines
[3GPP.git] / bin / 38331-convert.sh
index cd8267bada72bc6556e19261e85fc4613363bffa..2faf2129381dd4508b75fa3f9fdcfa3f4035d802 100755 (executable)
@@ -60,6 +60,9 @@ else
     LC_ALL=C sed -i 's/-- Cond N3C MP/-- Cond N3C-MP/' "${1%.docx}.txt"
     LC_ALL=C sed -i 's/^N3C MP/N3C-MP/' "${1%.docx}.txt"
     LC_ALL=C sed -i 's/-- Cond HOAndServCellAdd,$/-- Cond HOAndServCellAdd/' "${1%.docx}.txt"
+
+    iconv -f UTF-8 -t ASCII//TRANSLIT "${1%.docx}.txt" > "${1%.docx}.ascii"
+    mv "${1%.docx}.ascii" "${1%.docx}.txt"
 fi       
 
 cat "${1%.docx}.txt" | awk '/^-- ASN1START$/,/^-- ASN1STOP$/' | awk '!/^[[:space:]]*--/ && !/^[[:space:]]*$/'| sed -e 's/--.*$//g' > "${1%.docx}.asncheck"
@@ -69,28 +72,36 @@ if [[ ! -e "${1%.docx}.asncheck" ]] ; then
     exit
 fi
 
-txt2asn.awk "${1%.docx}.txt" > "${1%.docx}-descriptions-at-IEs-end.asn"
-cat "${1%.docx}-descriptions-at-IEs-end.asn" | awk '!/^[[:space:]]*--/ && !/^[[:space:]]*$/'| sed -e 's/--.*$//g' > "${1%.docx}-descriptions-at-IEs-end.asncheck"
-compare1=$(diff -b -B "${1%.docx}.asncheck" "${1%.docx}-descriptions-at-IEs-end.asncheck")
+mkdir -p by-IE
+cd by-IE
+txt2asn.awk "../${1%.docx}.txt" | awk '/^$/{ if (! blank++) print; next } { blank=0; print }' > "${1%.docx}.asn"
+cat "${1%.docx}.asn" | awk '!/^[[:space:]]*--/ && !/^[[:space:]]*$/'| sed -e 's/--.*$//g' > "${1%.docx}.asncheck"
+compare1=$(diff -b -B "../${1%.docx}.asncheck" "${1%.docx}.asncheck")
 if [[ "$compare1" ]] ; then
-    echo "The ASN.1 in ${1%.docx}-descriptions-at-IEs-end.asn does not fully match with the ASN.1 in ${1%.docx}.asncheck"
+    echo "The ASN.1 in by-IE/${1%.docx}.asn does not fully match with the ASN.1 in ${1%.docx}.asncheck"
     echo "Check with:"
-    echo "  diff -b -B ${1%.docx}.asncheck ${1%.docx}-descriptions-at-IEs-end.asncheck"
+    echo "  diff -b -B by-IE/${1%.docx}.asncheck ${1%.docx}.asncheck"
 else
-    rm "${1%.docx}-descriptions-at-IEs-end.asncheck"
+    rm "${1%.docx}.asncheck"
+    asn1-split.awk "${1%.docx}.asn"
 fi
 
-txt2asn-integrated.awk "${1%.docx}.txt" > "${1%.docx}-description-before-field.asn"
-cat "${1%.docx}-description-before-field.asn" | awk '!/^[[:space:]]*--/ && !/^[[:space:]]*$/'| sed -e 's/--.*$//g' > "${1%.docx}-description-before-field.asncheck"
-compare2=$(diff -b -B "${1%.docx}.asncheck" "${1%.docx}-description-before-field.asncheck")
+cd ..
+mkdir -p before-field
+cd before-field
+txt2asn-integrated.awk "../${1%.docx}.txt" | awk '/^$/{ if (! blank++) print; next } { blank=0; print }' > "${1%.docx}.asn"
+cat "${1%.docx}.asn" | awk '!/^[[:space:]]*--/ && !/^[[:space:]]*$/'| sed -e 's/--.*$//g' > "${1%.docx}.asncheck"
+compare2=$(diff -b -B "../${1%.docx}.asncheck" "${1%.docx}.asncheck")
 if [[ "$compare2" ]] ; then
-    echo "The ASN.1 in ${1%.docx}-description-before-field.asn does not fully match with the ASN.1 in ${1%.docx}.asncheck"
+    echo "The ASN.1 in before-field/${1%.docx}.asn does not fully match with the ASN.1 in ${1%.docx}.asncheck"
     echo "Check with:"
-    echo "  diff -b -B ${1%.docx}.asncheck ${1%.docx}-description-before-field.asncheck"
+    echo "  diff -b -B before-field/${1%.docx}.asncheck ${1%.docx}.asncheck"
 else
-    rm "${1%.docx}-description-before-field.asncheck"
+    rm "${1%.docx}.asncheck"
+    asn1-split.awk "${1%.docx}.asn"
 fi
 
+cd ..
 if [[ "$compare1" ]] || [[ "$compare1" ]] ; then
     exit
 else