Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Questa volta Script con Ping

    Ragasuoli sono sempre io...
    Questa volta ho bisogno di un altro piccolo favore.

    Una dritta su come fare uno scriptino.

    Do in pasto una lista con 500 hostname e pingando gli hostname mi da per ogni hostname
    il suo indirizzo ip e lo scrive in un altro file...

    Qualcuno mi da una mano ??


    codice:
    LISTA     -------------------> script -------------------> LISTA IP
    PC1                                                                              10.0.0.1
    PC2                                                                              10.0.0.2
    PC3                                                                              10.0.0.3
    PC4                                                                              10.0.0.4
    ecc ecc

    Ace
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

  2. #2
    prova questo:

    codice:
    #!/bin/bash
    
    while read line; do
      IP=`ping -c 1 $line | grep PING | cut -d " " -f 3`
      echo ${IP:1:${#IP}-2} >> file.out
    done < $1
    prende in ingresso un nome di file, contenente un'hostname per riga, restituisce file.out con un IP per riga

    edit: Risolto: avevo messo un hostname invece che la variabile line
    max

    Silence is better than bullshit.
    @mmarcon
    jHERE, Maps made easy

  3. #3
    ok, c'e' qualcosa che non va, l'ho appena testato, ma e' qualcosa da cui partire. adesso vedo se riesco a sistemarlo.
    max

    Silence is better than bullshit.
    @mmarcon
    jHERE, Maps made easy

  4. #4
    grande... ma sei un figo!!!
    Aspetta che mi ci metto pure io a fare qualche esperimento...
    Un inizio ben fondato c' è adesso magari riesco a trovare la retta via pure da solo...

    Grazie MXA
    There are two kinds of researchers:
    those that have implemented something and those that have not.
    The latter will tell you that there are 142 ways of doing things
    and that there isn't consensus on which is best.
    The former will simply tell you that 141 of them don't work.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.