allan

jq Recipes

Jul 18th, 2024
569
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. #
  2. # Pipe output from mgmt_cli
  3. # MGMT_CLI_USER=admin MGMT_CLI_PASSWORD=password mgmt_cli -f json show group uid <uid> | jq ...
  4. #
  5.  
  6. # List networks, hosts, IP range
  7. # Prints uid of sub-groups
  8. jq '.members|map(if .icon=="NetworkObjects/network" then "\(.subnet4)/\(."mask-length4")" else if .icon=="Objects/host" then "\(."ipv4-address")" else if .icon=="Objects/ip" then "\(."ipv4-address-first")-\(."ipv4-address-last")" else {"name": .name, "uid": .uid} end end end)'
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment