#! /bin/bash -eu
# Last edited on 2025-11-04 04:22:49 by stolfi

for io in \
    port-phon:bank/port/csp/main.txt \
    span-curr:bank/span/cas/main.txt \
    port-orig:bank/port/cso/main.txt \
    port-curr:bank/port/csm/main.txt \
  ; do
  oname="${io/:*/}"
  ifile="${io/*:/}"
  filter='cleanup_085_port_span_text.py'
  odir="out/text"
  mkdir -p ${odir}
  ofile="${odir}/${oname}.txt"
  cat ${ifile} \
    | join_parag_lines.gawk \
    | recode latin-1..utf8 \
    | ${filter} ${oname} \
    | fmt --split-only --width=72 \
    | cat -s \
    > ${ofile}
done

dicio-wc out/text/*.txt
