Есть файл
ft-v05.2003-01-15.161000+0300На перле в регулярных выражениях
if ( $file =~ /.*ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)/ )где ошибка?
>Есть файл
>ft-v05.2003-01-15.161000+0300
>
>На перле в регулярных выражениях
>if ( $file =~ /.*ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)/ )
>
>где ошибка?
в $file
>>Есть файл
>>ft-v05.2003-01-15.161000+0300
>>
>>На перле в регулярных выражениях
>>if ( $file =~ /.*ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)/ )
>>
>>где ошибка?
>
>
>в $fileЕсть файл
ft-v05.2003-01-15.161000+0300
#!/usr/bin/perl
$file = $ARGV[0];
if ( $file = /ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)(\W\d\d\d\d)/ ){
$cflowfile = "flows.".$1.$2.$3."_".$4.":".$5.":".$6;
$command = "/usr/local/bin/flow-export -f0 < $file > /home/flows/$cflowfile";
print "$command\n";
system($command);
}else{print "File $file didn't match\n";}А подробнее можно?
>Есть файл
>
>ft-v05.2003-01-15.161000+0300>if ( $file = /ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)(\W\d\d\d\d)/
А не проще будет так:
$file=~/ft-v05.\d{4}\-\d{2}-\d{2}\.\d{6}\+\d{4}/
За точность не ручаюсь. Короче смотри man perlre
>>>Есть файл
>>>ft-v05.2003-01-15.161000+0300
>>>
>>>На перле в регулярных выражениях
>>>if ( $file =~ /.*ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)/ )
>>>
>>>где ошибка?
>>
>>
>>в $file
>
>Есть файл
>
>ft-v05.2003-01-15.161000+0300
>
>
>
>#!/usr/bin/perl
>
>$file = $ARGV[0];
>
>if ( $file = /ft-v05\.(\d\d\d\d)-(\d\d)-(\d\d)\.(\d\d)(\d\d)(\d\d)(\W\d\d\d\d)/ ){
>$cflowfile = "flows.".$1.$2.$3."_".$4.":".$5.":".$6;
>$command = "/usr/local/bin/flow-export -f0 < $file > /home/flows/$cflowfile";
>print "$command\n";
>system($command);
>}else{print "File $file didn't match\n";}
>
>А подробнее можно?у меня этот шаблон отработал правильно
единственно что в написанном выше варианте не хватает ~