Template:egArpJcJq

From RaySoft

Syntax

{{egArpJcJq}}

Usage

Code

{{egArpJcJq}}

Result

Convert the ARP cache list to JSON with jc, remove some attributes and output it nicely with jq
arp -a | jc --arp | jq 'del(.[].name, .[].permanent)'

Output:

[
  {
    "address": "10.0.0.1",
    "hwtype": "ethernet",
    "hwaddress": "0:0:5e:0:1:1",
    "iface": "en9"
  },
  {
    "address": "10.0.0.6",
    "hwtype": "ethernet",
    "hwaddress": "b8:69:f4:1:70:b1",
    "iface": "en9"
  }
]