-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean_raw_files.sh
49 lines (41 loc) · 905 Bytes
/
clean_raw_files.sh
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
39
40
41
42
43
44
45
46
47
48
49
if [ ! -d "processed" ]; then
mkdir processed/
fi
cp raw/*.txt processed/
cd processed/
echo "Removing starting brackets from start of file..."
for f in $(grep -l "^\]\s" *.txt)
do
sed -i "s/^\]\s//" $f
done
for f in $(grep -l "^\.\]\s" *.txt)
do
sed -i "s/^\.\]\s//" $f
done
echo "Removing speaker tags..."
while read p
do
for f in $(grep -l "$p:" *.txt)
do
sed -i "s/$p://g" $f
done
done < ../speakers.txt
echo "Removing everything between brackets..."
for f in $(grep -l "\[.*\?\]" *.txt)
do
sed -i "s/\[[^]]*\]//g" $f
done
echo "Removing 'click for flash' text..."
for f in $(grep -l "click for flash" *.txt)
do
sed -i "s/click for flash//g" $f
done
echo "Removing laughter..."
for f in $(grep -El "\([Ll]augh(s|ter).\)" *.txt)
do
sed -ri "s/\([Ll]augh(s|ter).\)//g" $f
done
for f in $(grep -El "\([Ll]augh(s|ter)\)" *.txt)
do
sed -ri "s/\([Ll]augh(s|ter)\)//g" $f
done