tekkie has asked for the wisdom of the Perl Monks concerning the following question:
#!c:\perl -w use IO::File; use Shell; use strict; my @servers = qw(0.0.0.0 1.1.1.1 2.2.2.2); my $searchString = join(" ", (@ARGV)); foreach my $server (@servers) { my $path = '\\\SERVER\VOLUME\DIRECTORY\*'; my $dirPath = '\\\SERVER\VOLUME\DIRECTORY'; $path =~ s/SERVER/$server/g; $dirPath =~ s/SERVER/$server/g; my @dir = dir("$path"); foreach(@dir) { if(/^.*?\s+(\S+\.(\S{3}))$/) { unless($2 eq 'log' || $2 eq 'txt') { my $file = join('\\', ($dirPath, $1)); (my $numSet) = $1 =~ /^.([^.]+)\.\S{3}$/; undef $/; my $read = new IO::File; if($read->open("< $file")) { if(<$read> =~ /$searchString/g) { print "Found: $file\n"; foreach(@dir) { if(/^.*?\s+([A-Z]{1}$numSet\.\S{3})$/) { my $found = join('\\', ($dirPath, $1)); print "Found: $found\n"; } } } } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Where's the leak?
by dws (Chancellor) on Dec 23, 2002 at 20:51 UTC | |
by waswas-fng (Curate) on Dec 23, 2002 at 20:56 UTC | |
by dws (Chancellor) on Dec 23, 2002 at 21:05 UTC | |
by waswas-fng (Curate) on Dec 23, 2002 at 21:17 UTC | |
by Aristotle (Chancellor) on Dec 23, 2002 at 21:35 UTC | |
by waswas-fng (Curate) on Dec 23, 2002 at 21:49 UTC | |
by Aristotle (Chancellor) on Dec 23, 2002 at 22:54 UTC | |
|
Re: Where's the leak?
by waswas-fng (Curate) on Dec 23, 2002 at 20:25 UTC | |
|
Re: Where's the leak?
by BrowserUk (Patriarch) on Dec 23, 2002 at 23:23 UTC | |
by Aristotle (Chancellor) on Dec 24, 2002 at 01:34 UTC | |
by BrowserUk (Patriarch) on Dec 24, 2002 at 06:02 UTC | |
|
Re: Where's the leak?
by tekkie (Beadle) on Dec 23, 2002 at 20:49 UTC | |
by MarkM (Curate) on Dec 23, 2002 at 21:01 UTC | |
|
Re: Where's the leak?
by tekkie (Beadle) on Dec 26, 2002 at 13:35 UTC | |
|
Re: Where's the leak?
by waswas-fng (Curate) on Dec 23, 2002 at 20:29 UTC |