shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Experts em Regex


From: ppasouza
Subject: Experts em Regex
Date: Tue, 14 May 2013 17:50:01 -0000
User-agent: eGroups-EW/0.82

Boa tarde pessoal, estou quebrando a cabeça vendo se consigo uma
maneira de resolver esse meu problema com alguma(s) regex. O caso é o
seguinte, abaixo um segmento do problema:

         <host>            <host>cta_watchdog_energia_ central_faxina -
TEMPO MAX OFFLINE 20min</host>            <name>cta_watchdog_energia_
central_faxina - TEMPO MAX OFFLINE 20min</name>            <proxy/>
<status>0</status>            <ipmi_authtype>-1</ipmi_ authtype>
<ipmi_privilege>2</ipmi_ privilege>            <ipmi_username/>
<ipmi_password/>            <templates/>            <groups>
<group>                    <name>BR DIGITAL JOINVILLE - SC</name>
</group>            </groups>            <interfaces>               
<interface>                    <default>1</default>                   
<type>1</type>                    <useip>1</useip>                   
<ip>172.16.95.12</ip>                    <dns/>                   
<port>10050</port>                    <interface_ref>if1</interface_
ref>                </interface>            </interfaces>           
<applications>                <application>                   
<name>Disponibilidade</name>                </application>           
</applications>            <items>                <item>
<name>icmpms</name>                    <type>3</type>                   
<snmp_community/>                    <multiplier>1</multiplier>
<snmp_oid/>                    <key>icmppingsec</key>                   
<delay>30</delay>                    <history>180</history>
<trends>365</trends>                    <status>1</status>
<value_type>0</value_type>                    <allowed_hosts/>
<units>ms</units>                    <delta>0</delta>                   
<snmpv3_securityname/>                    <snmpv3_securitylevel>0</
snmpv3_securitylevel>                    <snmpv3_authpassphrase/>
<snmpv3_privpassphrase/>                    <formula>1000</formula>
<delay_flex/>                    <params/>                   
<ipmi_sensor/>                    <data_type>0</data_type>
<authtype>0</authtype>                    <username/>                   
<password/>                    <publickey/>                   
<privatekey/>                    <port>161</port>                   
<description/>                    <inventory_link>0</inventory_ link>
<applications/>                    <valuemap/>                   
<interface_ref>if1</interface_ ref>                </item>
<item>                    <name>Ping</name>                   
<type>3</type>                    <snmp_community/>                   
<multiplier>0</multiplier>                    <snmp_oid/>
<key>icmpping</key>                    <delay>30</delay>
<history>90</history>                    <trends>365</trends>
<status>0</status>                    <value_type>3</value_type>
<allowed_hosts/>                    <units/>                   
<delta>0</delta>                    <snmpv3_securityname/>
<snmpv3_securitylevel>0</ snmpv3_securitylevel>                   
<snmpv3_authpassphrase/>                    <snmpv3_privpassphrase/>
<formula>1</formula>                    <delay_flex/>                   
<params/>                    <ipmi_sensor/>                   
<data_type>0</data_type>                    <authtype>0</authtype>
<username/>                    <password/>                   
<publickey/>                    <privatekey/>                    <port/>
<description/>                    <inventory_link>0</inventory_ link>
<applications>                        <application>
<name>Disponibilidade</name>                        </application>
</applications>                    <valuemap/>                   
<interface_ref>if1</interface_ ref>                </item>           
</items>            <discovery_rules/>            <macros/>           
<inventory>                <inventory_mode>0</inventory_ mode>
<type/>                <type_full/>                <name/>
<alias/>                <os/>                <os_full/>               
<os_short/>                <serialno_a/>                <serialno_b/>
<tag/>                <asset_tag/>                <macaddress_a/>
<macaddress_b/>                <hardware/>               
<hardware_full/>                <software/>               
<software_full/>                <software_app_a/>               
<software_app_b/>                <software_app_c/>               
<software_app_d/>                <software_app_e/>               
<contact/>                <location/>                <location_lat/>
<location_lon/>                <notes>MONITORAMENTO DE ENERGIA CENTRAL
FAXINA / BR DIGITAL REGIONAL JOINVILLE - SC</notes>               
<chassis/>                <model>WATCHDOG</model>               
<hw_arch/>                <vendor>CIANET</vendor>               
<contract_number/>                <installer_name/>               
<deployment_status/>                <url_a/>                <url_b/>
<url_c/>                <host_networks/>                <host_netmask/>
<host_router/>                <oob_ip/>                <oob_netmask/>
<oob_router/>                <date_hw_purchase/>               
<date_hw_install/>                <date_hw_expiry/>               
<date_hw_decomm/>                <site_address_a/>               
<site_address_b/>                <site_address_c/>               
<site_city/>                <site_state>CURITIBA - PR</site_state>
<site_country>BRASIL</site_ country>                <site_zip/>
<site_rack/>                <site_notes/>                <poc_1_name/>
<poc_1_email/>                <poc_1_phone_a/>               
<poc_1_phone_b/>                <poc_1_cell/>               
<poc_1_screen/>                <poc_1_notes/>               
<poc_2_name/>                <poc_2_email/>               
<poc_2_phone_a/>                <poc_2_phone_b/>               
<poc_2_cell/>                <poc_2_screen/>               
<poc_2_notes/>            </inventory>        </host>
O que eu preciso é substituir o conteúdo da tag HOST  pelo
conteúdo da tag IP , além de substituir tudo que está dentro da
tag ITEMS, inclusive as tags, pela tag <items/> . Alguém tem alguma
ideia de como começar, ou se é possível?


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]