#! /bin/bash -eu
# Last edited on 2025-11-06 14:36:14 by stolfi

texts=( "$@" )

for tf in true fake; do 
  ifiles=()
  ofiles=()
  for ss in ${texts[@]} ; do 
    ifile="${ss}/${tf}.wdp"
    ofile="${ss}/${tf}.txt"
    echo "=== ${ifile} -> ${ofile} ===" 1>&2
    cat out/$ifile \
      | sed -e '/^ *$/d' \
      | fmt --width=72 \
      | sed -e 's:=:@=@:g' | tr '@' '\012' \
      | sed -e '/^ *$/d' -e 's:^[ ][ ]*::g' -e 's:[ ][ ]*$::g' \
      > out/${ofile}
    ifiles+=( ${ifile} )
    ofiles+=( ${ofile} )
  done
  ( cd out && dicio-wc ${ofiles[@]} )
  ( cd out && dicio-wc ${ifiles[@]} )
done
