Linux command
textql 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Query CSV
textql -sql "[SELECT * FROM file]" [data.csv]
With header
textql -header -sql "[SELECT name FROM file]" [data.csv]
Custom delimiter
textql -dlm=";" -sql "[query]" [data.csv]
Save to SQLite
textql -save-to [output.db] [data.csv]
Output to file
textql -output-file [result.csv] -sql "[query]" [data.csv]
说明
textql allows running SQL queries against structured text files such as CSV and TSV. It loads files into an in-memory SQLite database, treating each file as a table, and executes standard SQL queries against them. When -header is specified, the first row is used for column names; otherwise columns are named c0, c1, etc. Multiple files can be loaded simultaneously and joined using SQL JOIN syntax. The -save-to option persists the imported data to a SQLite database file for further analysis. Custom delimiters are supported with the -dlm flag.
参数
- -sql _QUERY_
- SQL query.
- -header
- First row is header.
- -dlm _CHAR_
- Field delimiter.
- -save-to _FILE_
- Save to SQLite.
- -output-file _FILE_
- Output file.
- -output-dlm _CHAR_
- Output delimiter.
FAQ
What is the textql command used for?
textql allows running SQL queries against structured text files such as CSV and TSV. It loads files into an in-memory SQLite database, treating each file as a table, and executes standard SQL queries against them. When -header is specified, the first row is used for column names; otherwise columns are named c0, c1, etc. Multiple files can be loaded simultaneously and joined using SQL JOIN syntax. The -save-to option persists the imported data to a SQLite database file for further analysis. Custom delimiters are supported with the -dlm flag.
How do I run a basic textql example?
Run `textql -sql "[SELECT * FROM file]" [data.csv]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -sql _QUERY_ do in textql?
SQL query.