Last active
October 16, 2015 00:20
-
-
Save kavyasukumar/f76f743cdeb285c099d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Track Twitter handles' stats every 30 seconds and dump into CSV | |
# Prereq: Install and set up t. Instruction at http://sferik.github.io/t/ | |
COUNTER=0 | |
# Backup current file | |
cp track.csv backup-`date +"%m-%d-%y"`.csv | |
# Write header to new file | |
t users --csv -l @realdonaldtrump @hillaryclinton | head -n1 > track.csv | |
while [ true ]; do | |
echo "Run $COUNTER starting." | |
t users --csv -l @realdonaldtrump @hillaryclinton | tail -n +2 | sed "s/^/`date`, /" >> track.csv | |
echo "Run $COUNTER ended. Sleeping...." | |
let COUNTER=COUNTER+1 | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment