Skip to main content
added 6 characters in body
Source Link
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k

The unsparsify verb of mlr ensures that all output records have all fields and adds empyempty values to non-existing fields (like in the broadcast field in the serondsecond record above).

The unsparsify verb of mlr ensures that all output records all fields and adds empy values to non-existing fields (like in the broadcast field in the serond record above).

The unsparsify verb of mlr ensures that all output records have all fields and adds empty values to non-existing fields (like in the broadcast field in the second record above).

On my system, at least, I need --barred
Source Link
terdon
  • 252.7k
  • 69
  • 481
  • 719
$ ip -j addr show enp1s0 | jq 'first.addr_info' | mlr --j2p --barred unsparsify +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ | family | local | prefixlen | broadcast | scope | dynamic | label | valid_life_time | preferred_life_time | +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ | inet | 192.168.1.191 | 24 | 192.168.1.255 | global | true | enp1s0 | 68465 | 68465 | | inet6 | fe80::2a0:aff:fe08:9aa6 | 64 | | link | | | 4294967295 | 4294967295 | +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ 
$ ip -j addr show enp1s0 | jq 'first.addr_info' | mlr --j2p barred unsparsify +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ | family | local | prefixlen | broadcast | scope | dynamic | label | valid_life_time | preferred_life_time | +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ | inet | 192.168.1.191 | 24 | 192.168.1.255 | global | true | enp1s0 | 68465 | 68465 | | inet6 | fe80::2a0:aff:fe08:9aa6 | 64 | | link | | | 4294967295 | 4294967295 | +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ 
$ ip -j addr show enp1s0 | jq 'first.addr_info' | mlr --j2p --barred unsparsify +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ | family | local | prefixlen | broadcast | scope | dynamic | label | valid_life_time | preferred_life_time | +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ | inet | 192.168.1.191 | 24 | 192.168.1.255 | global | true | enp1s0 | 68465 | 68465 | | inet6 | fe80::2a0:aff:fe08:9aa6 | 64 | | link | | | 4294967295 | 4294967295 | +--------+-------------------------+-----------+---------------+--------+---------+--------+-----------------+---------------------+ 
added 96 characters in body
Source Link
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k

Given your data from the question (fed straight into the mlr command above, as the addr_info array has already been extracted), this would produce

Given your data from the question, this would produce

Given your data from the question (fed straight into the mlr command above, as the addr_info array has already been extracted), this would produce

Source Link
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k
Loading