]> git.plutz.net Git - confetti/blobdiff - pdiread.sh
avoid space character in empty first name/middle name field; try to parse FN if N...
[confetti] / pdiread.sh
index 6f15658dc912c72a187c1559328e1e77a763b741..08fbaec3fb373c2fbb6cdde7974caaa520b849e3 100755 (executable)
@@ -26,6 +26,16 @@ include_pdi="$0"
 BR='
 '
 
+unescape() {
+  local unescape='s;(^(\\\\)*|[^\\](\\\\)*)\\n;\1\n;g; s;\\(.);\1;g'
+  if [ $# -eq 0 ]; then
+    sed -E "$unescape"
+  else
+    printf %s "$*" \
+    | sed -E "$unescape"
+  fi
+}
+
 pdi_load() {
   # normalise PDI file for processing with pdi_* functions
   # functions in this library can only be applied to normalised data