in reply to Re: Process multiple directories
in thread Process multiple directories

Hi thanos, I am the anon monk that posted the questions. Could not sign in to my account previously because most of the time I am using the company network to post the questions. If its not too much to ask for, I still have some questions in doubt.

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

u_ex171201.log u_ex171202.log u_ex171203.log u_ex171204.log
Note that the u_ex is a prefixed string.

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

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/; } } }
Any other response will be greatly appreciated and thank you so much y'all.. :)

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
    I have already resolved these questions. Thank you everyone for all your help! Cheers!