If you are on Windows you may consider using Log Parser Studio [1]. It is a GUI over logparser.exe which understands a lot of various file formats and uses SQL to query them [2]. [1] https://gallery.technet.microsoft.com/office/Log-Parser-Stud... [2] https://en.m.wikipedia.org/wiki/Logparser
TextQL: Execute SQL Against CSV or TSV
71–80 of 95 posts
Re: TextQL: Execute SQL Against CSV or TSV
#72Earlier quoted context omitted.
#!/usr/bin/env rc row_headers='' output_mode=column fn usage { echo $0 usage echo -o '#' which output mode to use echo -r '#' if present, output row headers echo -h '#' this message } while(~ $1 -*) { switch($1) { case -o output_mode=$2 shift case -r row_headers='.headers on' case -h usage exit 0 case * echo Bad args: $* usage exit 1 } shift } test $#* -ne 1 && echo Wrong number of arguments && usage && exit 1 sql_st…
Erm, people don't have rc installed though. I had completely forgotten it existed, to be honest.
Re: TextQL: Execute SQL Against CSV or TSV
#73Earlier quoted context omitted.
In this case, It’s what it does that matters, not how it does it. I don’t care if SQLLite is powering it. Maybe the author would want to swap out the SQLLite engine with something else in the future too. Then it’s even better that they didn’t advertise the link to SQLLite as a selling point.
It does actually matter what's running under, so you know what to expect from its behavior and if one doesn't exactly need the few features textQL offers exclusively, you would think to just use SQLite without random layers on top.
Re: TextQL: Execute SQL Against CSV or TSV
#74Earlier quoted context omitted.
But it is SQLite under the covers? A better title then would be an SQLite wrapper for use in shell pipelines.
In this case, It’s what it does that matters, not how it does it. I don’t care if SQLLite is powering it. Maybe the author would want to swap out the SQLLite engine with something else in the future too. Then it’s even better that they didn’t advertise the link to SQLLite as a selling point.
Re: TextQL: Execute SQL Against CSV or TSV
#75[0] http://bigbash.it or the corresponding Github repo.
Re: TextQL: Execute SQL Against CSV or TSV
#76ClickHouse ships with a command line tool which does this (without the actual database server): ps aux | tail -n +2 | awk '{ printf("%s\t%s\n", $1, $4) }' | \ clickhouse-local -S "user String, mem Float64" \ -q "SELECT user, round(sum(mem), 2) as memTotal FROM table GROUP BY user ORDER BY memTotal DESC FORMAT Pretty" ┏━━━━━━━━━━┳━━━━━━━━━━┓ ┃ user ┃ memTotal ┃ ┡━━━━━━━━━━╇━━━━━━━━━━┩ │ clickho+ │ 0.7 │ ├──────────┼──…
the additional requirement to set up the schema is kind of onerous.
$ ps aux | sqawk -output table \
'select user, round(sum("%mem"), 2) as memtotal
from a
group by user
order by memtotal desc' \
header=1
┌────────┬────┐
│dbohdan │67.1│
├────────┼────┤
│ root │3.5 │
├────────┼────┤
│ avahi │0.0 │
├────────┼────┤
│ daemon │0.0 │
├────────┼────┤
│message+│0.0 │
├────────┼────┤
│ nobody │0.0 │
├────────┼────┤
│ ntp │0.0 │
├────────┼────┤
│ rtkit │0.0 │
├────────┼────┤
│ syslog │0.0 │
├────────┼────┤
│ uuidd │0.0 │
├────────┼────┤
│whoopsie│0.0 │
└────────┴────┘
Link: https://github.com/dbohdan/sqawkRe: TextQL: Execute SQL Against CSV or TSV
#77Ha. Shameless plug, but just about a week ago I started to work on a somewhat analogous thing. Executing SQL on XML [1]. I came up with this idea after trying to use stackoverflow data dump and finding out it was stored as XML. I wanted to run queries with LIKE operator on it. [1]: https://github.com/kamac/AskXML
Re: TextQL: Execute SQL Against CSV or TSV
#78we should be aiming to kill SQL as a language
Re: TextQL: Execute SQL Against CSV or TSV
#79ClickHouse ships with a command line tool which does this (without the actual database server): ps aux | tail -n +2 | awk '{ printf("%s\t%s\n", $1, $4) }' | \ clickhouse-local -S "user String, mem Float64" \ -q "SELECT user, round(sum(mem), 2) as memTotal FROM table GROUP BY user ORDER BY memTotal DESC FORMAT Pretty" ┏━━━━━━━━━━┳━━━━━━━━━━┓ ┃ user ┃ memTotal ┃ ┡━━━━━━━━━━╇━━━━━━━━━━┩ │ clickho+ │ 0.7 │ ├──────────┼──…
the additional requirement to set up the schema is kind of onerous.
Re: TextQL: Execute SQL Against CSV or TSV
#80For anyone looking to do this with plain SQLite, one can import a CSV by running (in the REPL) .mode csv .headers on .import my.csv tablename This does look extremely convenient, though; being able to use UNIX pipes will be a huge improvement to my workflow.