blob: 0ef1d600ba220a026860c79d8411051815fec2c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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;
|