diff rapsodyn/SplitFile10x.pl @ 7:3f7b0788a1c4 draft

Uploaded
author mcharles
date Tue, 07 Oct 2014 10:34:34 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rapsodyn/SplitFile10x.pl	Tue Oct 07 10:34:34 2014 -0400
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+#V1.0.0
+use strict;
+use warnings;
+
+my $in = $ARGV[0];
+my $NB_LINE_GROUP = $ARGV[1];
+my $out1 = $ARGV[2];
+my $out2 = $ARGV[3];
+my $out3 = $ARGV[4];
+my $out4 = $ARGV[5];
+my $out5 = $ARGV[6];
+my $out6 = $ARGV[7];
+my $out7 = $ARGV[8];
+my $out8 = $ARGV[9];
+my $out9 = $ARGV[10];
+my $out10 = $ARGV[11];
+
+my $file_nb = 1;
+
+my @in;
+my $current_aggregate;
+open(IN, $in) or die ("Can't open $in\n");
+while (my $line =<IN>){
+	$current_aggregate = $line;
+	my $nb_line=1;
+	if ($NB_LINE_GROUP>1){
+		while (my $add_line = <IN>){
+			$current_aggregate .= $add_line;
+			$nb_line++;
+			if ($nb_line == $NB_LINE_GROUP){
+				last;
+			}
+		}
+	}	
+	push (@in,$current_aggregate);
+}
+close (IN);
+
+open (OUT1,">$out1") or die ("Can't open $out1");
+open (OUT2,">$out2") or die ("Can't open $out2");
+open (OUT3,">$out3") or die ("Can't open $out3");
+open (OUT4,">$out4") or die ("Can't open $out4");
+open (OUT5,">$out5") or die ("Can't open $out5");
+open (OUT6,">$out6") or die ("Can't open $out6");
+open (OUT7,">$out7") or die ("Can't open $out7");
+open (OUT8,">$out8") or die ("Can't open $out8");
+open (OUT9,">$out9") or die ("Can't open $out9");
+open (OUT10,">$out10") or die ("Can't open $out10");
+
+
+for (my $i=0;$i<=$#in;$i++){
+	if ($i <= $#in * 1 /10){
+		print OUT1 $in[$i];
+	}
+	elsif ($i <= $#in* 2 /10){
+		print OUT2 $in[$i];
+	}
+	elsif ($i <= $#in*3/10){
+		print OUT3 $in[$i];
+	}
+	elsif ($i <= $#in*4/10){
+		print OUT4 $in[$i];
+	}
+	elsif ($i <= $#in*5/10){
+		print OUT5 $in[$i];
+	}
+	elsif ($i <= $#in*6/10){
+		print OUT6 $in[$i];
+	}
+	elsif ($i <= $#in*7/10){
+		print OUT7 $in[$i];
+	}
+	elsif ($i <= $#in*8/10){
+		print OUT8 $in[$i];
+	}
+	elsif ($i <= $#in*9/10){
+		print OUT9 $in[$i];
+	}
+	elsif ($i <= $#in*10/10){
+		print OUT10 $in[$i];
+	}
+	else {
+
+	}
+
+
+}  
+close (OUT1);
+close (OUT2);
+close (OUT3);
+close (OUT4);
+
+