twitools/datecsv.sh
Klaus-Uwe Mitterer 0c4eb44444 Convert gethandles.py to Python 3
Directly output datecsv.sh results
2015-04-13 22:11:42 +02:00

15 lines
483 B
Bash
Executable file

#!/bin/bash
DATAFILE=Database.db
SQLITE="sqlite3 -csv -header"
QUERY="SELECT SUBSTR(t.timestamp,0,11) AS 'Date', (SELECT COUNT(*) FROM tweets e WHERE SUBSTR(e.timestamp,0,11) = SUBSTR(t.timestamp,0,11)) AS 'Tweets'"
for i in $@;
do QUERY="$QUERY, (SELECT COUNT(*) FROM tweets e WHERE SUBSTR(e.timestamp,0,11) = SUBSTR(t.timestamp,0,11) AND LOWER(e.text) LIKE '%${i,,}%') AS '$i'"
done
QUERY="$QUERY FROM tweets t GROUP BY SUBSTR(t.timestamp,0,11);"
$SQLITE $DATAFILE "$QUERY"