Skip to content

Instantly share code, notes, and snippets.

@kowey
Last active August 29, 2015 13:56
Show Gist options
  • Save kowey/8932231 to your computer and use it in GitHub Desktop.
Save kowey/8932231 to your computer and use it in GitHub Desktop.
sqlite> .mode column
sqlite> .width 40
sqlite> .headers on
sqlite> select lex_trade_VBEchange_DU1 as key, count(*) as count from tbl group by key order by count desc;
key count
---------------------------------------- ----------
__nil__ 15527
givable 2747
receivable 942
mixte 432
givable mixte 113
mixte receivable 97
givable receivable 63
givable mixte receivable 10
sqlite> select lex_domain_ressource_DU1 as key, count(*) as count from tbl group by key order by count desc;
key count
---------------------------------------- ----------
__nil__ 14675
clay 904
sheep 783
ore 727
wood 707
wheat 630
sheep wood 149
sheep wheat 147
wheat wood 142
ore wood 133
clay ore 129
clay wheat 127
clay sheep 126
clay wood 124
ore wheat 105
ore sheep 87
clay ore sheep 33
ore wheat wood 29
clay sheep wheat 26
clay wheat wood 23
clay sheep wheat wood 21
ore sheep wheat 21
sheep wheat wood 20
ore sheep wheat wood 17
clay ore wood 15
clay ore wheat 14
clay ore sheep wood 8
clay ore sheep wheat 6
ore sheep wood 3
#!/bin/bash
if [ $# -ne 1 ]; then
echo >&2 "Need a csv file"
exit 1
fi
T=`mktemp -t stac.textql.XXXX`
sed -e '1 s/.#//g' -e '1 s/\*/star/g' -e '1 s/\?//g' $1 > $T
textql -header -console -source=$T
rm $T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment