Primary Lines in this Script
Line 4
- Store a table called grouping in the database worstloss that keeps track of the first value of the time column, last value of the bet column, and minimum value in the winnings column for each unique value of the country and user columns.
Line 8
- Tell Essentia to look for data on your local datastore.
Line 10
- Create a new rule to take any files in your home directory with ‘onlinecasino’ in their name and put them in the casino category. Also tell Essentia not to look for a date in the filenames.
Line 14
- Pipe all files in the category casino to the aq_pp command.
- In the aq_pp command, tell the preprocessor to take data from stdin, ignoring errors and skipping the first line (the header).
- Then define the incoming data’s columns and import the data to the vector in the worstloss database so the attributes listed there can be applied.
Line 16
- Internally sort the records in the database, within each unique country, by winnings. Since this is internal, it has no output.
Line 17
- Export the modified and sorted data from the database and then save the results to a csv file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ess drop database worstloss
ess create database worstloss --ports=1
ess create table grouping s,pkey:country s,+key:user s,+first:time i,+last:bet f,+min:winnings
ess udbd start
ess select local
ess category add casino "$HOME/*onlinecasino*" --dateformat none
ess summary
ess stream casino "*" "*" "aq_pp -f,+1,eok - -d s:user s:time i:bet f:winnings s:country -udb_imp worstloss:grouping" --debug
ess exec "aq_udb -db worstloss -ord grouping winnings" --debug
ess exec "aq_udb -db worstloss -exp grouping -o worstloss.csv" --debug
ess udbd stop
|