1

I have a raw text configuration from a load balancer and want to grep for only the virtual servers that have a TCP profile applied. A sample config is below, and from this I would just like to output the first line (I can use awk later to just filter on the VS name if needed). Note that I'm doing this offline, without access to the device.

ltm virtual /Common/custom_ldap-vs {
    destination /Common/10.1.1.2:389
    ip-protocol tcp
    mask 255.255.255.255
    persist {
        /Common/source_addr {
            default yes
        }
    }
    pool /Common/dev_itim_rhitimdevtds_ldap-pool
    profiles {
       <b> /Common/Custom_tcp_Profile { } </b>
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    translate-address enabled
    translate-port enabled
    vlans {
        /Common/vlan_3
    }
    vlans-enabled
}

1 Answer 1

1

Try first stripping the newlines out of the file. Then break out each virtual server into it's own line. Then you can grep for your profile string:

perl -pe 's/\n//mg' yourfile.txt | perl -pe 's/ltm virtual/\n/g' | grep Custom_tcp_Profile | perl -pe 's/(.*?){.*/$1/'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .