summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrothedev <grothedev@gmail.com>2022-04-02 15:20:44 -0500
committergrothedev <grothedev@gmail.com>2022-04-02 15:20:44 -0500
commitbd350248819996d31e43418ff881faeb3c223835 (patch)
tree08d4b9a819d5dd378e094b3f17d5dadc1c9c9157
parent84dec96006d7c049fe7c1216087e369513a3c813 (diff)
added text from files compilation script
-rwxr-xr-xtotxt38
1 files changed, 38 insertions, 0 deletions
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;
+