• # awk

    Posté par (site web personnel) . En réponse au message Shell script / parse XML, limites ?. Évalué à 2.

    Je parse souvent du XML avec awk, alors oui c'est crade mais c'est hyper rapide, exemple

    awk -F"<|>|=" '{
     if (0ドル ~ /Host name/) {
     host=3ドル
     } else if (0ドル ~ /ID/) {
     linehost=host";"4ドル
     } else if (0ドル ~ /title/) {
     linehost=linehost";"3ドル
     print linehost
     linehost=""
     }
    }' toto.xml
    root@game:~# sh toto.sh
    "192.168.1.2";"22344";Mine
    "192.168.1.2";"22301";Nope
    "192.168.1.2";"22899";Goog
    "192.168.1.4";"22111";M
    "192.168.1.4";"22864";Nope
    "192.168.1.4";"22800";Goog
    

    Is it a Bird? Is it a Plane?? No, it's Super Poil !!!