formatRES.pl
1.04 KB
#!/usr/bin/perl -w
use strict;
use File::Basename;
## Example file name 110827TF1_19002000#349405:888#F#S509.res
open(RES,$ARGV[0]) or die ("Can't open Speeral RES file: $ARGV[0]");
if(<RES>!~m/#/){
print "Old format... processing changes...\n";
my @t=split("#",$ARGV[0]);
my $showName=basename($t[0]);
#my $showName=$t[0];
my $startStop=$t[1];
my $gender=$t[2];
my $spker=$t[3];
$spker=~s/\.res//;
#print $showName." ".$startStop." ".$gender." ".$spker."\n";
close(RES);
open(RES,$ARGV[0]) or die ("Can't open Speeral RES file: $ARGV[0]");
open(RES2,">".$ARGV[0]."2") or die ("Can't write to Speeral new RES file: $ARGV[0]2");
while(<RES>){
my $line=$_;
chomp($line);
my @tab=split(" ",$line);
print RES2 $showName."#".$startStop."#".$gender."#".$spker." ".$tab[1]." ".$tab[2]." ".$tab[3]." ".$tab[4]." ".$tab[5]."\n";
}
my $cmd="mv $ARGV[0]2 $ARGV[0]";
`$cmd`;
print "OK !!\n";
}
#else {my $toto=exec "echo ".<RES>." \|grep # ".<RES>;
#print $toto."\n";
#}