github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/jsplit.md (about) 1 # `jsplit` 2 3 > Splits STDIN into a JSON array based on a regex parameter 4 5 ## Description 6 7 `jsplit` will read from STDIN and split it based on a regex parameter. It outputs a JSON array. 8 9 ## Usage 10 11 ``` 12 <STDIN> -> jsplit regex -> <stdout> 13 ``` 14 15 ## Examples 16 17 ``` 18 ยป (hello, world) -> jsplit l+ 19 [ 20 "he", 21 "o, wor", 22 "d" 23 ] 24 ``` 25 26 ## Detail 27 28 `jsplit` will trim trailing carriage returns and line feeds from each element 29 as well as any trailing empty elements (zero length strings) in the JSON array. 30 However any empty elements will be retained and any other whitespace characters 31 - or carriage returns and/or line feeds in the middle of an element - will be 32 retained. 33 34 This is so that the formatting of (multiline) text is retained as much as 35 possible to ensure the `jsplit` is accurate while at the same time any commonly 36 unwanted "noise" is stripped from the output. 37 38 ## Synonyms 39 40 * `jsplit` 41 * `list.split` 42 43 44 ## See Also 45 46 * [`2darray` ](../commands/2darray.md): 47 Create a 2D JSON array from multiple input sources 48 * [`[ ..Range ]`](../parser/range.md): 49 Outputs a ranged subset of data from STDIN 50 * [`[ Index ]`](../parser/item-index.md): 51 Outputs an element from an array, map or table 52 * [`[[ Element ]]`](../parser/element.md): 53 Outputs an element from a nested structure 54 * [`a` (mkarray)](../commands/a.md): 55 A sophisticated yet simple way to build an array or list 56 * [`append`](../commands/append.md): 57 Add data to the end of an array 58 * [`count`](../commands/count.md): 59 Count items in a map, list or array 60 * [`ja` (mkarray)](../commands/ja.md): 61 A sophisticated yet simply way to build a JSON array 62 * [`map`](../commands/map.md): 63 Creates a map from two data sources 64 * [`msort`](../commands/msort.md): 65 Sorts an array - data type agnostic 66 * [`mtac`](../commands/mtac.md): 67 Reverse the order of an array 68 * [`prepend`](../commands/prepend.md): 69 Add data to the start of an array 70 71 <hr/> 72 73 This document was generated from [builtins/core/lists/jsplit_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/lists/jsplit_doc.yaml).