in reply to filter the files in a folder on the basis of some variable present in them
#pseudo-code $|++; #flush output to stdout as soon as possible my @files = glob '*.txt'; foreach my $file (@files){ my ($var_one, $var_two ...); #your var names to be checked open my $fh, '<', $file or die "..."; while (<$fh>) { #use regex to put something inside $var_one, $var_two } # if (all vars needed are defined and pass your check){ print "$file + IS VALID\n"; system 'mv $file /new/path' } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: filter the files in a folder on the basis of some variable present in them
by reciter (Novice) on Jun 10, 2015 at 09:54 UTC | |
by Discipulus (Canon) on Jun 10, 2015 at 11:51 UTC | |
by reciter (Novice) on Jun 11, 2015 at 04:03 UTC | |
by u65 (Chaplain) on Jun 10, 2015 at 11:54 UTC |