From bd350248819996d31e43418ff881faeb3c223835 Mon Sep 17 00:00:00 2001 From: grothedev Date: Sat, 2 Apr 2022 15:20:44 -0500 Subject: added text from files compilation script --- totxt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 totxt diff --git a/totxt b/totxt new file mode 100755 index 0000000..0ef1d60 --- /dev/null +++ b/totxt @@ -0,0 +1,38 @@ +#!/bin/bash +# +# this script will generate a text file containing all the text of the files (including odt files) from the given folder +# args: +# none: use current dir, output results +# 1 (./this [dir]): use given dir, output result +# 2:(./this [dir] [file]): use given dir, write result to given file + + +if [[ $1 ]]; then + d=${1} +else + d="./" +fi + +if [[ $2 ]]; then + outf=${2} +fi + + +for f in `ls ${d} -A`; do + echo $f + if [[ ${f} == *".odt" ]]; then + t=`odt2txt ${f}` + else + t=`cat ${f}` + fi + if [[ ${outf} ]]; then + echo ${f} >> comp + echo ${t} >> comp; + echo >> comp; + else + echo ${f} + echo ${t}; + echo ""; + fi +done; + -- cgit v1.2.3