in reply to Re: Process multiple directories
in thread Process multiple directories
1. What happens if I have another directory, e.g., named TESTDIRECTORY that contains log files in this format: u_exYYMMDD.log, how can I also grep all my relevant IPs from these directories that does not have the date in the directory name? Here is the sample files in TESTDIRECTORY
Note that the u_ex is a prefixed string.u_ex171201.log u_ex171202.log u_ex171203.log u_ex171204.log
2. As the other anon monk have asked, how do I match with multiple IP addresses under this portion of the code? My sample input would be like 192.168.1.0,192.168.1.1,192.168.1.2
Any other response will be greatly appreciated and thank you so much y'all.. :)sub searchForIP { my ($files, $ip) = @_; my @files = @$files; for my $file (@files){ my $filename = $file; my $fh = IO::Uncompress::Bunzip2->new($filename) or die "bunzi +p2 $filename: $IO::Uncompress::Bunzip2::Bunzip2Error"; while (<$fh>){ print "$filename:$.:$_" if /$ip/; } } }
2018-01-09 Athanasius restored deleted content
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Process multiple directories
by dotowwxo (Acolyte) on Jan 10, 2018 at 06:48 UTC |