-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombine_files.sh
executable file
·57 lines (47 loc) · 1.46 KB
/
combine_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
50
51
52
53
54
55
56
57
#!/bin/sh
# Project: Reappropriation
# Author: Karandeep Singh Nagra
# Combine various files together for easier processing.
# Some of these files used integers primary keys;
# so each file has to be sectioned out with a line
# of form @@@<name_of_file> at the beginning.
echo "COMBINE FILES $1"
internal_dir=$1
# Remove files generated by old runs of this program first.
for i in all_food.txt all_maint.txt all_events.txt all_notes.txt
do
if [ -e $i ]
then
rm $i
fi
done
# Food files
for i in food-2011.txt food-2012.txt food.txt
do
echo "@@@$i" >> all_food.txt
cat $internal_dir/$i >> all_food.txt
done
# Maintenance files
for i in maintenance-2004.txt maintenance-2005.txt maintenance-2006.txt \
maintenance-2007.txt maintenance-2008.txt maintenance-2009.txt \
maintenance-2010.txt maintenance.txt
do
echo "@@@$i" >> all_maint.txt
cat $internal_dir/$i >> all_maint.txt
done
# Events files
for i in events-2002.txt events-2003.txt events-2004.txt events-2005.txt \
events-2006.txt events-2007.txt events-2008.txt events-2009.txt \
events-2010.txt events.txt
do
echo "@@@$i" >> all_events.txt
cat $internal_dir/$i >> all_events.txt
done
# Notes files
for i in notes-2002.txt notes-2003.txt notes-2004.txt notes-2005.txt \
notes-2006.txt notes-2007.txt notes-2008.txt notes-2009.txt \
notes-2010.txt notes-2011.txt notes-2012.txt notes-2013.txt notes.txt
do
echo "@@@$i" >> all_notes.txt
cat $internal_dir/$i >> all_notes.txt
done