#!/bin/bash bdir=$1 cd "$bdir" SAVEIFS=$IFS IFS=$(echo -en "\n\b") for bookdir in $(find openbess* -type d); do echo "$bookdir" cd "$bookdir" n=0 SAVEIFS=$IFS IFS=$(echo -en "\n\b") for nfile in $(find *.pdf -type f); do let "n += 1" filedoc="$nfile" done if [ $n -gt 1 ] || [ $n -lt 1 ] then echo "ERROR file PDF non unico" exit fi IFS=$SAVEIFS cp "$filedoc" doc.pdf rm "$filedoc" docsplit text --pages all --no-ocr --no-clean --output OCR/ doc.pdf cd OCR n=0 SAVEIFS=$IFS IFS=$(echo -en "\n\b") for nfile in $(find *.txt -type f); do numer=${nfile#doc_} numero=${numer%\.txt} sn=$(printf "%04d" $numero) tr -d '\f' < "$nfile" > "$sn".txt rm "$nfile" echo "$sn"" DONE" done IFS=$SAVEIFS cd ~ echo "DONE **************************""$bookdir" done exit