Blame view

tools/scripts/formatRES.pl 1.04 KB
e6be5137b   Jean-François Rey   reinitialized pro...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  #!/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...
  ";
      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."
  ";
      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]."
  ";
      }
      my $cmd="mv $ARGV[0]2 $ARGV[0]";
      `$cmd`;
      print "OK !!
  ";
  }
  #else {my $toto=exec "echo ".<RES>." \|grep # ".<RES>;
  #print $toto."
  ";
  #}