SQL Statements
6 methods核心 SQLite DDL、DML 和 PRAGMA 语句。
grep [-i] [-v] [-E] [-n] [-r] pattern [file...]创建新表。SQLite 使用动态类型;常见亲和性为 TEXT、INTEGER、REAL、BLOB、NUMERIC。
Parameters
| Name | Type | Description |
|---|---|---|
| pattern | regex | Pattern to match. |
| file | string | Files to search; reads stdin if omitted. |
Returns
void
Example
linux
grep -nE 'function\s+\w+' src/*.tssed [-i] -e 'script' [file...]通过字面值或从另一查询选择来向表中插入行。
Parameters
| Name | Type | Description |
|---|---|---|
| script | string | Editing commands, e.g. s/old/new/g. |
| file | string | Input file(s). |
Returns
void
Example
linux
sed -i 's/\r$//' *.shawk [-F sep] 'program' [file...]从表中读取行,可选过滤、排序和限制。
Parameters
| Name | Type | Description |
|---|---|---|
| sep | string | Field separator (default whitespace). |
| program | string | Pattern { action } pairs. |
Returns
void
Example
linux
awk -F, '{ sum += $2 } END { print sum }' data.csvsort [-n] [-r] [-u] [-k F[,F]] [file...]查询或设置 SQLite 编译时和运行时选项,如 foreign_keys、journal_mode、table_info。
Parameters
| Name | Type | Description |
|---|---|---|
| file | string | Input file(s); reads stdin if omitted. |
Returns
void
Example
linux
sort -nrk 2 scores.txt | head -5uniq [-c] [-d] [-u] [file]Filters or reports adjacent repeated lines; usually preceded by sort. -c prefixes count.
Parameters
| Name | Type | Description |
|---|---|---|
| file | string | Input file; reads stdin if omitted. |
Returns
void
Example
linux
sort access.log | uniq -c | sort -nr | headtee [-a] file...Reads from stdin and writes to stdout and the given files; -a appends instead of overwriting.
Parameters
| Name | Type | Description |
|---|---|---|
| file | string | Output file(s). |
Returns
void
Example
linux
npm test 2>&1 | tee build.log