github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/2darray.md (about)

     1  # `2darray` 
     2  
     3  > Create a 2D JSON array from multiple input sources
     4  
     5  ## Description
     6  
     7  `2darray` merges multiple input sources to create a two dimensional array in JSON
     8  
     9  ## Usage
    10  
    11  ```
    12  2darray { code-block } { code-block } -> <stdout>
    13  ```
    14  
    15  ## Examples
    16  
    17  ```
    18  » ps -fe -> head -n 10 -> set ps 
    19  » 2darray { $ps[UID] } { $ps[PID] } { $ps[TTY] } { $ps[TIME] }
    20  [
    21      [
    22          "",
    23          "",
    24          "",
    25          ""
    26      ],
    27      [
    28          "UID",
    29          "PID",
    30          "TTY",
    31          "TIME"
    32      ],
    33      [
    34          "root",
    35          "1",
    36          "?",
    37          "00:00:02"
    38      ],
    39      [
    40          "root",
    41          "2",
    42          "?",
    43          "00:00:00"
    44      ],
    45      [
    46          "root",
    47          "3",
    48          "?",
    49          "00:00:00"
    50      ],
    51      [
    52          "root",
    53          "4",
    54          "?",
    55          "00:00:00"
    56      ],
    57      [
    58          "root",
    59          "6",
    60          "?",
    61          "00:00:00"
    62      ],
    63      [
    64          "root",
    65          "8",
    66          "?",
    67          "00:00:00"
    68      ],
    69      [
    70          "root",
    71          "9",
    72          "?",
    73          "00:00:03"
    74      ],
    75      [
    76          "root",
    77          "10",
    78          "?",
    79          "00:00:19"
    80      ],
    81      [
    82          "root",
    83          "11",
    84          "?",
    85          "00:00:01"
    86      ]
    87  ]
    88  ```
    89  
    90  ## Detail
    91  
    92  `2darray` can have as many or as few code blocks as you wish.
    93  
    94  ## See Also
    95  
    96  * [`[ ..Range ]`](../parser/range.md):
    97    Outputs a ranged subset of data from STDIN
    98  * [`[ Index ]`](../parser/item-index.md):
    99    Outputs an element from an array, map or table
   100  * [`a` (mkarray)](../commands/a.md):
   101    A sophisticated yet simple way to build an array or list
   102  * [`append`](../commands/append.md):
   103    Add data to the end of an array
   104  * [`count`](../commands/count.md):
   105    Count items in a map, list or array
   106  * [`ja` (mkarray)](../commands/ja.md):
   107    A sophisticated yet simply way to build a JSON array
   108  * [`json`](../types/json.md):
   109    JavaScript Object Notation (JSON)
   110  * [`jsplit` ](../commands/jsplit.md):
   111    Splits STDIN into a JSON array based on a regex parameter
   112  * [`map`](../commands/map.md):
   113    Creates a map from two data sources
   114  * [`msort`](../commands/msort.md):
   115    Sorts an array - data type agnostic
   116  * [`mtac`](../commands/mtac.md):
   117    Reverse the order of an array
   118  * [`prepend`](../commands/prepend.md):
   119    Add data to the start of an array
   120  
   121  <hr/>
   122  
   123  This document was generated from [builtins/core/arraytools/2darray_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/arraytools/2darray_doc.yaml).