JobyJ has asked for the wisdom of the Perl Monks concerning the following question:
I want to be able to process all files that follow the specific filenaming e.g. 2017_06_30_013901_0828900840_17062901D602BG So I want to process only files that contain *****************_0828900840_********D602BG with the help of the below code I was able to process all the files that have "D602BG". How can I achive my additional requirement within the same code.
foreach my $folder (@folders) { # glob the contents of the folder (to get the file names) my @contents = <$folder/*>; # For each filename in the list, if it matches foreach my $item ( @contents ) { if ($item =~ /C602DZB/){ #File name with specific +pattern open my $info, $item or die "Could not ope +n $item: $!"; while( my $line = <$info>) { if ($line =~ /Total/){ #Multiple pa +ttern match done push (@lines, $line); #Matching + lines pushed to an array } } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pick up specific file name
by choroba (Cardinal) on Jul 07, 2017 at 14:22 UTC | |
|
Re: Pick up specific file name (updated)
by haukex (Archbishop) on Jul 07, 2017 at 14:20 UTC | |
|
Re: Pick up specific file name
by thanos1983 (Parson) on Jul 07, 2017 at 14:23 UTC | |
by Laurent_R (Canon) on Jul 07, 2017 at 17:51 UTC | |
|
Re: Pick up specific file name
by 1nickt (Canon) on Jul 07, 2017 at 14:25 UTC | |
by soonix (Chancellor) on Jul 08, 2017 at 15:49 UTC |