Timeline.py
Revision as of 18:37, 24 May 2008 by PeterHarding (talk | contribs) (New page: <pre> #!/usr/bin/env perl # # $Id:$ # #------------------------------------------------- @types = ('backline', 'frontline', 'teamlead', 'operations'); @nodes = ('node1', 'node2', 'node3'...)
#!/usr/bin/env perl # # $Id:$ # #------------------------------------------------- @types = ('backline', 'frontline', 'teamlead', 'operations'); @nodes = ('node1', 'node2', 'node3', 'node6'); $no_nodes = $#nodes + 1; printf "Building data for %d nodes\n", $no_nodes; #---- Rewrite ------------------------------------ foreach $type (@types) { $in = sprintf("users_%s_node1.dat", $type); $out = sprintf("users_%s_%dnodes.dat", $type, $no_nodes); open IN, "< $in"; open OUT, "> $out"; $_ = <IN>; print OUT $_; $cnt = 0; while (<IN>) { $idx = $cnt % $no_nodes; s/node1/$nodes[$idx]/; print OUT $_; $cnt++; } close IN; close OUT; } #-------------------------------------------------