View on GitHub


q - Text as Data

Download the last stable version zip file Download the last stable version tar.gz file Download the latest stable version RPM Download the latest stable version Debian package Download the single-file executable Download the single-file executable



Behind the Scenes




This is a tutorial for beginners. If you're familiar with the concept and just wanna see some full fledged examples, take a look at the examples page.

Tutorial steps:

A simple example

We'll start with a simple example and work from there. The file exampledatafile contains the output of an ls -l command, a list of files in some directory. In this example we'll do some calculations on this file list.

A more complicated example, showing time manipulation

Let's assume that we have a file with a timestamp as its first column. We'll show how it's possible to get the number of rows per full minute:

q "SELECT DATETIME(ROUND(c1/60000)*60000/1000,'unixepoch','-05:00') as min, COUNT(1) FROM datafile*.gz GROUP BY min"

There are several things to notice here: