github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/parser/range.md (about) 1 # `[ ..Range ]` 2 3 > Outputs a ranged subset of data from STDIN 4 5 ## Description 6 7 This will read from STDIN and output a subset of data in a defined range. 8 9 The range can be defined as a number of different range types - such as the 10 content of the array or it's index / row number. You can also omit either 11 the start or the end of the search criteria to cover all items before or 12 after the remaining search criteria. 13 14 **Please note that `@[` syntax has been deprecated in favour of `[` syntax 15 instead** 16 17 ## Usage 18 19 ``` 20 <stdin> -> [start..end]flags -> <stdout> 21 ``` 22 23 ## Examples 24 25 **Range over all months after March:** 26 27 ``` 28 » a [January..December] -> [March..]se 29 April 30 May 31 June 32 July 33 August 34 September 35 October 36 November 37 December 38 ``` 39 40 **Range from the 6th to the 10th month:** 41 42 By default, ranges start from one, `1` 43 44 ``` 45 » a [January..December] -> [5..9] 46 May 47 June 48 July 49 August 50 September 51 ``` 52 53 **Return the first 3 months:** 54 55 This usage is similar to `head -n3` 56 57 ``` 58 » a [January..December] -> [..3] 59 October 60 November 61 December 62 ``` 63 64 **Return the last 3 months:** 65 66 This usage is similar to `tail -n3` 67 68 ``` 69 » a [January..December] -> [-3..] 70 October 71 November 72 December 73 ``` 74 75 ## Flags 76 77 * `8` 78 handles backspace characters (char 8) instead of treating it like a printable character 79 * `b` 80 removes blank (empty) lines from source 81 * `e` 82 exclude the start and end search criteria from the range 83 * `n` 84 numeric offset (indexed from 0) 85 * `r` 86 regexp match 87 * `s` 88 exact string match 89 * `t` 90 trims whitespace from source 91 92 ## Synonyms 93 94 * `@[` 95 96 97 ## See Also 98 99 * [`[ Index ]`](../parser/item-index.md): 100 Outputs an element from an array, map or table 101 * [`[[ Element ]]`](../parser/element.md): 102 Outputs an element from a nested structure 103 * [`a` (mkarray)](../commands/a.md): 104 A sophisticated yet simple way to build an array or list 105 * [`alter`](../commands/alter.md): 106 Change a value within a structured data-type and pass that change along the pipeline without altering the original source input 107 * [`append`](../commands/append.md): 108 Add data to the end of an array 109 * [`count`](../commands/count.md): 110 Count items in a map, list or array 111 * [`ja` (mkarray)](../commands/ja.md): 112 A sophisticated yet simply way to build a JSON array 113 * [`jsplit` ](../commands/jsplit.md): 114 Splits STDIN into a JSON array based on a regex parameter 115 * [`prepend`](../commands/prepend.md): 116 Add data to the start of an array 117 118 <hr/> 119 120 This document was generated from [builtins/core/ranges/ranges_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/ranges/ranges_doc.yaml).