Skip to content

Instantly share code, notes, and snippets.

@kavyasukumar
Last active October 16, 2015 00:20
Show Gist options
  • Save kavyasukumar/f76f743cdeb285c099d3 to your computer and use it in GitHub Desktop.
Save kavyasukumar/f76f743cdeb285c099d3 to your computer and use it in GitHub Desktop.
#!/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