From df39a1e35eb70e14d611502e1cc040609440b621 Mon Sep 17 00:00:00 2001 From: Noboru Saito Date: Thu, 26 Dec 2024 21:53:09 +0900 Subject: [PATCH] Added explanation for `-itext` in README.md --- README.md | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f855c84..e6d7eac 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,12 @@ For usage as a library, please refer to the [godoc](https://pkg.go.dev/github.co * 4.11. [JSONL(NDJSON)](#jsonl(ndjson)) * 4.12. [YAML](#yaml) * 4.13. [TBLN](#tbln) - * 4.14. [WIDTH](#width) - * 4.15. [TEXT](#text) - * 4.16. [Raw output](#raw-output) - * 4.17. [ASCII Table & MarkDown output](#ascii-table-&-markdown-output) - * 4.18. [Vertical format output](#vertical-format-output) + * 4.14. [TEXT](#text) + * 4.15. [WIDTH](#width) + * 4.16. [TEXT](#text-1) + * 4.17. [Raw output](#raw-output) + * 4.18. [ASCII Table & MarkDown output](#ascii-table-&-markdown-output) + * 4.19. [Vertical format output](#vertical-format-output) * 5. [SQL](#sql) * 5.1. [SQL function](#sql-function) * 5.2. [JOIN](#join) @@ -88,7 +89,7 @@ make install #### 1.1.1. Requirements -go 1.19 or higher. +go 1.22 or higher. ### 1.2. Download binary @@ -776,7 +777,27 @@ $ trdsql -otbln "SELECT c1::int as id, c2::text as name FROM test.csv" TBLN can contain column names and type definitions. Please refer to for details of TBLN. -### 4.14. WIDTH +### 4.14. TEXT + +`-itext` is input from TEXT. + +`-itext` treats the text up to the end of the line as a single column. When combined with `-inum`, it can be used as a table with line numbers and text. + +```console +$ cat sample.txt +This is a sample text. +Another line of text. +Yet another line. +``` + +```console +$ trdsql -itext -inum "SELECT * FROM sample.txt" +1,This is a sample text. +2,Another line of text. +3,Yet another line. +``` + +### 4.15. WIDTH `-iwidth` inputs the format specifying the width. This is used when the header column width represents the body column width. @@ -795,7 +816,7 @@ But `-id " "` does not recognize spaces in columns very well. `-iwidth` recognizes column widths and space separators. -### 4.15. TEXT +### 4.16. TEXT The `-itext` option or files with “.text”extension are in text format. @@ -828,7 +849,7 @@ $ trdsql -inum "SELECT * FROM test.text" 5,c ``` -### 4.16. Raw output +### 4.17. Raw output `-oraw` is Raw Output. It is used when "escape processing is unnecessary" in CSV output. @@ -853,7 +874,7 @@ $ trdsql -oraw -od "\t|\t" -db pdb "SELECT * FROM test.csv" 3 | Apple ``` -### 4.17. ASCII Table & MarkDown output +### 4.18. ASCII Table & MarkDown output `-oat` is ASCII table output. @@ -881,7 +902,7 @@ $ trdsql -omd "SELECT * FROM test.csv" The `-onowrap` option does not wrap long columns in `at` or `md` output. -### 4.18. Vertical format output +### 4.19. Vertical format output -ovf is Vertical format output("column name | value" vertically).