IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Shell et commandes GNU Discussion :

[SHELL] Créer Commandes avec un fichier CSV


Sujet :

Shell et commandes GNU

  1. #1
    Membre averti
    Homme Profil pro
    Administrateur Sécurité et Réseau
    Inscrit en
    Mai 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Administrateur Sécurité et Réseau

    Informations forums :
    Inscription : Mai 2012
    Messages : 40
    Par défaut [SHELL] Créer Commandes avec un fichier CSV
    Bonjour,

    J'ai besoin d'un coup de pouce sur un petit script.

    Comment il doit fonctionner :

    Un fichier CSV en Source avec 3 champs (HOST;PEER;N) comme variable d'entrée

    Une petite boucle qui me génère des commandes de mon choix avec les infos contenus dans le CSV.


    Mon script :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    #!/bin/bash
    file=`cat /root/peer.csv`
    echo "{OBJECT_TYPE};{COMMAND};{PARAMETERS}"
    for line in $file
    do
       echo $line
       HOST=`echo $line | awk -F";" '{print $1}'`
       PEER=`echo $line | awk -F";" '{print $2}'`
       N=`echo $line | awk -F";" '{print $3}'`
     
          echo "SERVICE;ADD;$1;PEER_$2-BGP;App-Protocols-BGP-Peer-SNMP"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_is_volatile;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_active_checks_enabled;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_passive_checks_enabled;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_parallelize_check;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_obsess_over_service;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_check_freshness;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_event_handler_enabled;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_flap_detection_enabled;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_process_perf_data;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_retain_status_information;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_retain_nonstatus_information;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_notifications_enabled;2"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;contact_additive_inheritance;0"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;cg_additive_inheritance;0"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_inherit_contacts_from_host;1"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_use_only_contacts_from_host;0"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_locked;0"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_register;1"
          echo "SERVICE;setparam;$1;PEER_$2-BGP;service_activate;1"
          echo "SERVICE;setmacro;$1;PEER_$2-BGP;peer;$2;;''"
          echo "SERVICE;setmacro;$1;PEER_$2-BGP;lower;$3;;''"
          echo "SERVICE;setmacro;$1;PEER_$2-BGP;upper;$3;;''"
     
    done

    Mon souci : Boucle OK, mais pas de donnée en lieu et place des variables

    Quand j'exécute le script j'ai cela :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    {OBJECT_TYPE};{COMMAND};{PARAMETERS}
    HOST;PEER;N
    SERVICE;ADD;;PEER_-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;;PEER_-BGP;service_is_volatile;2
    SERVICE;setparam;;PEER_-BGP;service_active_checks_enabled;2
    SERVICE;setparam;;PEER_-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;;PEER_-BGP;service_parallelize_check;2
    SERVICE;setparam;;PEER_-BGP;service_obsess_over_service;2
    SERVICE;setparam;;PEER_-BGP;service_check_freshness;2
    SERVICE;setparam;;PEER_-BGP;service_event_handler_enabled;2
    SERVICE;setparam;;PEER_-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;;PEER_-BGP;service_process_perf_data;2
    SERVICE;setparam;;PEER_-BGP;service_retain_status_information;2
    SERVICE;setparam;;PEER_-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;;PEER_-BGP;service_notifications_enabled;2
    SERVICE;setparam;;PEER_-BGP;contact_additive_inheritance;0
    SERVICE;setparam;;PEER_-BGP;cg_additive_inheritance;0
    SERVICE;setparam;;PEER_-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;;PEER_-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;;PEER_-BGP;service_locked;0
    SERVICE;setparam;;PEER_-BGP;service_register;1
    SERVICE;setparam;;PEER_-BGP;service_activate;1
    SERVICE;setmacro;;PEER_-BGP;peer;;;''
    SERVICE;setmacro;;PEER_-BGP;lower;;;''
    SERVICE;setmacro;;PEER_-BGP;upper;;;''

    Une âme charitable pourrait m'aider ?

    Un grand merci par avance.

  2. #2
    Expert confirmé Avatar de Flodelarab
    Homme Profil pro
    Inscrit en
    Septembre 2005
    Messages
    5 288
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Charente (Poitou Charente)

    Informations forums :
    Inscription : Septembre 2005
    Messages : 5 288
    Par défaut
    Bonjour

    Boucle OK
    "Boucle OK" ? "Boucle OK" ?
    Rien du tout. Ce script est fait à l'envers du bon sens.

    Est-ce que tu peux fournir le fichier CSV d'entrée et le fichier de sortie attendu ?

  3. #3
    Membre averti
    Homme Profil pro
    Administrateur Sécurité et Réseau
    Inscrit en
    Mai 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Administrateur Sécurité et Réseau

    Informations forums :
    Inscription : Mai 2012
    Messages : 40
    Par défaut
    Le CSV est dans cette esprit

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    HOST,PEER,N;
    hos1;@ip_1,4;
    hos1;@ip_1,4;
    hos1;@ip_1,4;
    hos2;@ip_1,16;
    hos2;@ip_1,3;
    hos3;@ip_1,2;
    Le retour attendu (en prenant la 1er ligne):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
           SERVICE;ADD;host1;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP 
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_is_volatile;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_active_checks_enabled;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_passive_checks_enabled;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_parallelize_check;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_obsess_over_service;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_check_freshness;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_event_handler_enabled;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_flap_detection_enabled;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_process_perf_data;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_retain_status_information;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_notifications_enabled;2
           SERVICE;setparam;host1;PEER_@ip_1-BGP;contact_additive_inheritance;0
           SERVICE;setparam;host1;PEER_@ip_1-BGP;cg_additive_inheritance;0
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_locked;0
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_register;1
           SERVICE;setparam;host1;PEER_@ip_1-BGP;service_activate;1
           SERVICE;setmacro;host1;PEER_@ip_1-BGP;peer;@ip_1;;''
           SERVICE;setmacro;host1;PEER_@ip_1-BGP;lower;4;;''
           SERVICE;setmacro;host1;PEER_@ip_1-BGP;upper;4;;''

    J’enverrais les résultats dans un fichier retour.cfg

  4. #4
    Expert confirmé Avatar de Flodelarab
    Homme Profil pro
    Inscrit en
    Septembre 2005
    Messages
    5 288
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Charente (Poitou Charente)

    Informations forums :
    Inscription : Septembre 2005
    Messages : 5 288
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    awk -F '[,;]' '(NR>1){print "SERVICE;ADD;"$1";PEER_"$2"-BGP;App-Protocols-BGP-Peer-SNMP";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_is_volatile;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_active_checks_enabled;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_passive_checks_enabled;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_parallelize_check;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_obsess_over_service;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_check_freshness;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_event_handler_enabled;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_flap_detection_enabled;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_process_perf_data;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_retain_status_information;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_retain_nonstatus_information;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_notifications_enabled;2";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;contact_additive_inheritance;0";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;cg_additive_inheritance;0";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_inherit_contacts_from_host;1";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_use_only_contacts_from_host;0";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_locked;0";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_register;1";
    print "SERVICE;setparam;"$1";PEER_"$2"-BGP;service_activate;1";
    print "SERVICE;setmacro;"$1";PEER_"$2"-BGP;peer;"$2";;''";
    print "SERVICE;setmacro;"$1";PEER_"$2"-BGP;lower;"$3";;''";
    print "SERVICE;setmacro;"$1";PEER_"$2"-BGP;upper;"$3";;''";
    }' fichier.csv
    SERVICE;ADD;hos1;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_is_volatile;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_active_checks_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_parallelize_check;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_obsess_over_service;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_check_freshness;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_event_handler_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_process_perf_data;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_retain_status_information;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_notifications_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;contact_additive_inheritance;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;cg_additive_inheritance;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_locked;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_register;1
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_activate;1
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;peer;@ip_1;;
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;lower;4;;
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;upper;4;;
    SERVICE;ADD;hos1;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_is_volatile;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_active_checks_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_parallelize_check;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_obsess_over_service;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_check_freshness;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_event_handler_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_process_perf_data;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_retain_status_information;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_notifications_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;contact_additive_inheritance;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;cg_additive_inheritance;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_locked;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_register;1
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_activate;1
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;peer;@ip_1;;
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;lower;4;;
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;upper;4;;
    SERVICE;ADD;hos1;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_is_volatile;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_active_checks_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_parallelize_check;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_obsess_over_service;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_check_freshness;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_event_handler_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_process_perf_data;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_retain_status_information;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_notifications_enabled;2
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;contact_additive_inheritance;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;cg_additive_inheritance;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_locked;0
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_register;1
    SERVICE;setparam;hos1;PEER_@ip_1-BGP;service_activate;1
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;peer;@ip_1;;
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;lower;4;;
    SERVICE;setmacro;hos1;PEER_@ip_1-BGP;upper;4;;
    SERVICE;ADD;hos2;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_is_volatile;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_active_checks_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_parallelize_check;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_obsess_over_service;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_check_freshness;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_event_handler_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_process_perf_data;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_retain_status_information;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_notifications_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;contact_additive_inheritance;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;cg_additive_inheritance;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_locked;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_register;1
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_activate;1
    SERVICE;setmacro;hos2;PEER_@ip_1-BGP;peer;@ip_1;;
    SERVICE;setmacro;hos2;PEER_@ip_1-BGP;lower;16;;
    SERVICE;setmacro;hos2;PEER_@ip_1-BGP;upper;16;;
    SERVICE;ADD;hos2;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_is_volatile;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_active_checks_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_parallelize_check;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_obsess_over_service;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_check_freshness;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_event_handler_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_process_perf_data;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_retain_status_information;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_notifications_enabled;2
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;contact_additive_inheritance;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;cg_additive_inheritance;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_locked;0
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_register;1
    SERVICE;setparam;hos2;PEER_@ip_1-BGP;service_activate;1
    SERVICE;setmacro;hos2;PEER_@ip_1-BGP;peer;@ip_1;;
    SERVICE;setmacro;hos2;PEER_@ip_1-BGP;lower;3;;
    SERVICE;setmacro;hos2;PEER_@ip_1-BGP;upper;3;;
    SERVICE;ADD;hos3;PEER_@ip_1-BGP;App-Protocols-BGP-Peer-SNMP
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_is_volatile;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_active_checks_enabled;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_passive_checks_enabled;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_parallelize_check;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_obsess_over_service;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_check_freshness;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_event_handler_enabled;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_flap_detection_enabled;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_process_perf_data;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_retain_status_information;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_retain_nonstatus_information;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_notifications_enabled;2
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;contact_additive_inheritance;0
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;cg_additive_inheritance;0
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_inherit_contacts_from_host;1
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_use_only_contacts_from_host;0
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_locked;0
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_register;1
    SERVICE;setparam;hos3;PEER_@ip_1-BGP;service_activate;1
    SERVICE;setmacro;hos3;PEER_@ip_1-BGP;peer;@ip_1;;
    SERVICE;setmacro;hos3;PEER_@ip_1-BGP;lower;2;;
    SERVICE;setmacro;hos3;PEER_@ip_1-BGP;upper;2;;
    Bon, là, évidemment, il y a une seule commande.
    Tu peux le mettre dans un script mon_script.awk pour plus d'élégance.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    mon_script.awk fichier.csv > retour.cfg

  5. #5
    Membre averti
    Homme Profil pro
    Administrateur Sécurité et Réseau
    Inscrit en
    Mai 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Administrateur Sécurité et Réseau

    Informations forums :
    Inscription : Mai 2012
    Messages : 40
    Par défaut
    Un grand merci à toi Flodelarab

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Comparer le contenu d'une table avec un fichier csv
    Par cdo22 dans le forum Requêtes
    Réponses: 3
    Dernier message: 21/11/2008, 18h35
  2. Créer et enregistrer un fichier csv
    Par JAMINF dans le forum JSF
    Réponses: 5
    Dernier message: 31/10/2008, 16h44
  3. VBScript : Créer puis ouvrir un fichier csv
    Par Stephbzh dans le forum VBScript
    Réponses: 1
    Dernier message: 04/06/2008, 09h36
  4. [CSV] Problème avec un fichier csv
    Par gregal dans le forum Langage
    Réponses: 7
    Dernier message: 13/02/2007, 11h23
  5. Mise à jour d'une table avec un fichier csv
    Par blackangel dans le forum PostgreSQL
    Réponses: 4
    Dernier message: 26/05/2005, 14h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo