diff --git a/README.md b/README.md index 2d2ad1c..ec5e6d9 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ trdsql -o[output format] -t [input filename] * `-iyaml` YAML format for input. * `-itbln` TBLN format for input. * `-iwidth` width specification format for input. +* `-itext` text format for input. #### 3.2.1. Input options @@ -193,6 +194,7 @@ trdsql -o[output format] -t [input filename] * `-ijq` **string** jq expression string for input(JSON/JSONL only). * `-ilr` **int** limited number of rows to read. * `-inull` **string** value(string) to convert to null on input. +* `-inum` add row number column. * `-ir` **int** number of rows to preread. (default 1) * `-is` **int** skip header row. @@ -792,6 +794,39 @@ But `-id " "` does not recognize spaces in columns very well. `-iwidth` recognizes column widths and space separators. +### TEXT + +The `-itext` option or files with “.text”extension are in text format. + +This is a one line to one column format. +A blank line is also a line, unlike the `CSV` format. + +```console +$ cat test.text +a + +b + +c +$ trdsql -itext "SELECT * FROM test.text" +a + +b + +c +``` + +It is useful in conjunction with the -inum option. + +```console +$ trdsql -inum "SELECT * FROM test.text" +1,a +2, +3,b +4, +5,c +``` + ### 4.15. Raw output `-oraw` is Raw Output. diff --git a/reader.go b/reader.go index bc6b6b7..41a26cc 100644 --- a/reader.go +++ b/reader.go @@ -18,6 +18,7 @@ var extToFormat map[string]Format = map[string]Format{ "TSV": TSV, "PSV": PSV, "WIDTH": WIDTH, + "TEXT": TEXT, } // ReaderFunc is a function that creates a new Reader.