-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfchgrp.sh
75 lines (66 loc) · 1.46 KB
/
fchgrp.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#Basic script for running fch program over multiple users
function printHelp
{
echo "Usage: ./fchgroup.sh (path_to_txt) (parameter 1) ... (parameter n)"
echo "fchgrp uses the same parameters as fch:"
echo "-h show this help message and exit"
echo "--st=[DATETIME] Memento start datetime (in RFC 1123 datetime format)"
echo "--et=[DATETIME] Memento end datetime (in RFC 1123 datetime format)"
echo "--freq=[SECONDS] Sampling frequency of mementos (in seconds)"
echo "-f=[PATH] Output file dump path (DEFAULT: ./fchoutput)"
exit
}
if [ -z "$1" ]
then
echo "Usage: ./fchgrp.sh (path_to_txt) (parameter 1) ... (parameter n)"
exit
elif [ $1 == "-h" ]
then
printHelp
else
input=$1
fi
#shift the parameter list by one to ignore the file name
shift
path="-f="$(pwd)
for var in "$@"
do
case $var in
--st=*)
st=$var
;;
--et=*)
et=$var
;;
--freq=*)
freq=$var
;;
-f=*)
path=$var
;;
*)
echo "error: '$var' Unknown Parameter."
printHelp
;;
esac
done
while IFS= read -r user; do
echo $user
#Gather Memento data from twitter
csvpath=$path/$user/$user.csv
#Create Directory for user data if none exists
if [ -d ${path#*-f=}/$user ]; then
#do nothing
:
else
mkdir ${path#*-f=}/$user
fi
fch $user $csvpath $st $et $freq
if [ -f ${csvpath#*-f=} ]; then
#Generate Graphs from csv data
Rscript twitterFollowerCount.R ${csvpath#*-f=}
else
echo "error: csv file was not created."
fi
done < $input