0c4eb44444
Directly output datecsv.sh results
15 lines
483 B
Bash
Executable file
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"
|