Sample Header Ad - 728x90

Extract data from multiple nested parenthesis in TCL

0 votes
1 answer
373 views
I need another help, this is in continuation of [Extract data from the nested parenthesis in bash](https://unix.stackexchange.com/questions/580031/extract-data-from-the-nested-parenthesis-in-bash) , I have input data like below with multiple blocks, I want to put a logic to check for network vlans block alone, exclude the auths, network trunk, network interface blocks. auths remote { roles { admin { role administrator } readonly { role read-only } } } auths ldap system { login-attribute uid port 636 } network vlan internal-vlan { description "internal-use" interfaces { 1.1 { } 1.2 { } } MTU { 1500 } } network vlan external-vlan { description "external-use" interfaces { 2.1 { } 2.2 { } } MTU { 1500 } } network vlan dummy-vlan { description "dummy-use" interfaces { 1.1 { } } } network trunk { description "none" } network interface 1.1 { Status { UP } } network interface 1.2 { Status { UP } } network interface 2.1 { Status { DOWN } } network interface 2.2 { Status { UP } } system update settings { frequency monthly } I want similar output as before. I think I have to make a parent function and put a if logic to check if the block starts with "network vlan" then trigger the proc network. If I can put a if logic to check for string "network vlan" and then trigger a proc, i think i can relate for rest of configs and create new functions wherever needed.
Asked by IceAndFire (3 rep)
Apr 16, 2020, 04:56 AM
Last activity: Apr 16, 2020, 01:59 PM