File: convert.pl

package info (click to toggle)
clonalorigin 1.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,800 kB
  • sloc: cpp: 10,488; perl: 349; xml: 130; makefile: 48; sh: 33
file content (20 lines) | stat: -rwxr-xr-x 520 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
#Converts an output file from the old format (December) to the new format(January)

if ($#ARGV!=1) {die("Usage: convert.pl [input] [output]\n");}

open($file,$ARGV[0]) or die("Can't open file ",$ARGV[0],"\n");
open($fileout,">",$ARGV[1]) or die("Can't open output file\n");

while ($buf=<$file>) {
if ( $buf =~ /<Tree>/ ) {
$tree=<$file>;
$buf=<$file>;
} elsif ( $buf =~ /<Iteration>/ ) {
print $fileout $buf."<Tree>\n".$tree."</Tree>\n";
} else {
print $fileout $buf;
}
}
close($file);
close($fileout);