zuinc has asked for the wisdom of the Perl Monks concerning the following question:
Any help would be greatly appreciated. The idea of using the IP module has already been mentioned to me but I am also using this as an excuse to improve my perl skills. =) Thanks.# Create a list of all possible IP addresses within subnet open(ALLIP, ">allip.list") || die "Unable to create file: allip.list\n +"; for ($i=0; $i<=20; $i++) { print ALLIP "$ip_subnet.$i\n"; } close(ALLIP); open(ALLIP, "allip.list") || die "Unable to open file: allip.list\n"; open(PINGALLIP, ">pingallip.list") || die "Unable to open file: pingal +lip.list"; while (<ALLIP>) { chomp; system("ping $_ >>pingallip.list") && "Unable to create file: +pingallip. list"; } close(ALLIP); close(PINGALLIP); open(ALIVEIP, ">aliveip.list"); close(ALIVEIP); open(ALIVEIP, "aliveip.list"); open(PINGALLIP, "pingallip.list") || die "Unable to open file: pingall +ip.list"; while (<PINGALLIP>) { if (/is alive/) { chomp; print ALIVEIP $_; } } close(PINGALLIP);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing matched lines
by perlplexer (Hermit) on Apr 09, 2002 at 18:35 UTC | |
|
Re: Printing matched lines
by Kanji (Parson) on Apr 09, 2002 at 18:39 UTC | |
|
Re: Printing matched lines
by emilford (Friar) on Apr 09, 2002 at 18:38 UTC | |
|
Re: Printing matched lines
by Zaxo (Archbishop) on Apr 09, 2002 at 18:36 UTC | |
|
Re: Printing matched lines
by dug (Chaplain) on Apr 09, 2002 at 18:36 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |