annotate rapsodyn/SplitFile10x.pl @ 10:0a6c1cfe4dc8 draft

Uploaded
author mcharles
date Mon, 19 Jan 2015 04:33:21 -0500
parents 3f7b0788a1c4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
1 #!/usr/bin/perl
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
2 #V1.0.0
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
3 use strict;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
4 use warnings;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
5
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
6 my $in = $ARGV[0];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
7 my $NB_LINE_GROUP = $ARGV[1];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
8 my $out1 = $ARGV[2];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
9 my $out2 = $ARGV[3];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
10 my $out3 = $ARGV[4];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
11 my $out4 = $ARGV[5];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
12 my $out5 = $ARGV[6];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
13 my $out6 = $ARGV[7];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
14 my $out7 = $ARGV[8];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
15 my $out8 = $ARGV[9];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
16 my $out9 = $ARGV[10];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
17 my $out10 = $ARGV[11];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
18
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
19 my $file_nb = 1;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
20
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
21 my @in;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
22 my $current_aggregate;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
23 open(IN, $in) or die ("Can't open $in\n");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
24 while (my $line =<IN>){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
25 $current_aggregate = $line;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
26 my $nb_line=1;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
27 if ($NB_LINE_GROUP>1){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
28 while (my $add_line = <IN>){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
29 $current_aggregate .= $add_line;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
30 $nb_line++;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
31 if ($nb_line == $NB_LINE_GROUP){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
32 last;
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
33 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
34 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
35 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
36 push (@in,$current_aggregate);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
37 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
38 close (IN);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
39
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
40 open (OUT1,">$out1") or die ("Can't open $out1");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
41 open (OUT2,">$out2") or die ("Can't open $out2");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
42 open (OUT3,">$out3") or die ("Can't open $out3");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
43 open (OUT4,">$out4") or die ("Can't open $out4");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
44 open (OUT5,">$out5") or die ("Can't open $out5");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
45 open (OUT6,">$out6") or die ("Can't open $out6");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
46 open (OUT7,">$out7") or die ("Can't open $out7");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
47 open (OUT8,">$out8") or die ("Can't open $out8");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
48 open (OUT9,">$out9") or die ("Can't open $out9");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
49 open (OUT10,">$out10") or die ("Can't open $out10");
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
50
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
51
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
52 for (my $i=0;$i<=$#in;$i++){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
53 if ($i <= $#in * 1 /10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
54 print OUT1 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
55 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
56 elsif ($i <= $#in* 2 /10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
57 print OUT2 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
58 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
59 elsif ($i <= $#in*3/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
60 print OUT3 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
61 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
62 elsif ($i <= $#in*4/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
63 print OUT4 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
64 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
65 elsif ($i <= $#in*5/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
66 print OUT5 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
67 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
68 elsif ($i <= $#in*6/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
69 print OUT6 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
70 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
71 elsif ($i <= $#in*7/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
72 print OUT7 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
73 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
74 elsif ($i <= $#in*8/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
75 print OUT8 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
76 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
77 elsif ($i <= $#in*9/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
78 print OUT9 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
79 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
80 elsif ($i <= $#in*10/10){
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
81 print OUT10 $in[$i];
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
82 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
83 else {
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
84
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
85 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
86
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
87
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
88 }
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
89 close (OUT1);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
90 close (OUT2);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
91 close (OUT3);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
92 close (OUT4);
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
93
3f7b0788a1c4 Uploaded
mcharles
parents:
diff changeset
94