View on GitHub

q

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

General

Documentation

Behind the Scenes

Author

Social

Version 1.5.0 is out! Feedback is most welcome

q is a command line tool that allows direct execution of SQL-like queries on CSVs/TSVs (and any other tabular text files).

q treats ordinary files as database tables, and supports all SQL constructs, such as WHERE, GROUP BY, JOINs etc. It supports automatic column name and column type detection, and provides full support for multiple encodings.

        q "SELECT COUNT(*) FROM ./clicks_file.csv WHERE c3 > 32.3"
      

        ps -ef | q -H "SELECT UID,COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"
      

Look at the examples page for some more examples, or just download the tool using the links above or in the installation page and play with it.


完全支持所有的字符编码

すべての文字エンコーディングを完全にサポート

모든 문자 인코딩이 완벽하게 지원됩니다

все кодировки символов полностью поддерживаются

Non-english users: q fully supports all types of encoding. Use "-e data-encoding" to set the input data encoding, "-Q query-encoding" to set the query encoding, and use "-E output-encoding" to set the output encoding. Sensible defaults are in place for all three parameters. Please contact me if you encounter any issues and I'd be glad to help.