github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/types/csv.md (about) 1 # `csv` 2 3 > CSV files (and other character delimited tables) 4 5 ## Description 6 7 This data type can be used for not only CSV files but also TSV (tab separated) 8 or any other exotic characters used as a delimiter. 9 10 ## Detail 11 12 The CSV parser is configurable via `config` (see link below for docs on how to 13 use `config`) 14 15 ``` 16 ยป config -> [csv] 17 { 18 "comment": { 19 "Data-Type": "str", 20 "Default": "#", 21 "Description": "The prefix token for comments in a CSV table.", 22 "Dynamic": false, 23 "Global": false, 24 "Value": "#" 25 }, 26 "separator": { 27 "Data-Type": "str", 28 "Default": ",", 29 "Description": "The delimiter for records in a CSV file.", 30 "Dynamic": false, 31 "Global": false, 32 "Value": "," 33 } 34 } 35 ``` 36 37 ## Default Associations 38 39 * **Extension**: `csv` 40 * **MIME**: `application/csv` 41 * **MIME**: `application/x-csv` 42 * **MIME**: `text/csv` 43 * **MIME**: `text/x-csv` 44 45 46 ## Supported Hooks 47 48 * `Marshal()` 49 Supported 50 * `ReadArray()` 51 Treats each new line as a new array element 52 * `ReadArrayWithType()` 53 Treats each new line as a new array element, each element is mini `csv` file 54 * `ReadIndex()` 55 Indexes treated as table coordinates 56 * `ReadMap()` 57 Works against tables such as the output from `ps -fe` 58 * `ReadNotIndex()` 59 Indexes treated as table coordinates 60 * `Unmarshal()` 61 Supported 62 * `WriteArray()` 63 Writes a new line per array element 64 65 ## See Also 66 67 * [`*` (generic)](../types/generic.md): 68 generic (primitive) 69 * [`[[ Element ]]`](../parser/element.md): 70 Outputs an element from a nested structure 71 * [`cast`](../commands/cast.md): 72 Alters the data type of the previous function without altering it's output 73 * [`config`](../commands/config.md): 74 Query or define Murex runtime settings 75 * [`format`](../commands/format.md): 76 Reformat one data-type into another data-type 77 * [`int`](../types/int.md): 78 Whole number (primitive) 79 * [`jsonl`](../types/jsonl.md): 80 JSON Lines 81 * [`select`](../optional/select.md): 82 Inlining SQL into shell pipelines 83 * [`str` (string)](../types/str.md): 84 string (primitive) 85 * [index](../parser/item-index.md): 86 Outputs an element from an array, map or table 87 88 ### Read more about type hooks 89 90 - [`ReadIndex()` (type)](../apis/ReadIndex.md): Data type handler for the index, `[`, builtin 91 - [`ReadNotIndex()` (type)](../apis/ReadNotIndex.md): Data type handler for the bang-prefixed index, `: Read from a data type one array element at a time 93 - [`WriteArray()` (type)](../apis/WriteArray.md): Write a data type, one array element at a time 94 - [`ReadMap()` (type)](../apis/ReadMap.md): Treat data type as a key/value structure and read its contents 95 - [`Marshal()` (type)](../apis/Marshal.md): Converts structured memory into a structured file format (eg for stdio) 96 - [`Unmarshal()` (type)](../apis/Unmarshal.md): Converts a structured file format into structured memory 97 98 <hr/> 99 100 This document was generated from [builtins/types/csv/csv_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/types/csv/csv_doc.yaml).