in reply to Re: filter the files in a folder on the basis of some variable present in them
in thread filter the files in a folder on the basis of some variable present in them
Hi discipulus, I am a novice to perl thats why I do so much blunder. I tried another way to filter files. Instead using x2 z2 and all as variable I tried to search them as pattern. but it also having problem can you please check and tell what can I do so it may start working. I have updated once
#usr/bin/perl use strict; use warnings; $|++; #flush output to stdout as soon as possible my @files = glob '*.txt'; my $pat='/^x2=0.[6-9][0-9][0-9][0-9][0-9]\n'; my $pat1='/^z2=0.[6-9][0-9][0-9][0-9][0-9]\n'; my $pat3='/^some_t2=0.[6-9][0-9][0-9][0-9][0-9]\n'; foreach my $file (@files) { foreach my $file1(@files) { foreach my $files2(@files) { if (($file=~/^$pat/) && ($file1=~/^$pat1/) && ($$file2=~/^$pat3/)) { print "$file IS VALID\n"; system 'mv $file E:\test\some' } } else print "not relevant\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: filter the files in a folder on the basis of some variable present in them
by Discipulus (Canon) on Jun 10, 2015 at 11:51 UTC | |
by reciter (Novice) on Jun 11, 2015 at 04:03 UTC | |
|
Re^3: filter the files in a folder on the basis of some variable present in them
by u65 (Chaplain) on Jun 10, 2015 at 11:54 UTC |