I got a big file what is making of 8 lines blocks. What I need is to take one block at a time and print it in a file named, for example, 1.dat, take the second one and put it in a 2.dat file.
this is the input file to work:
5.04786152982032E+00 4.23000449311482E+00 8.04732158465680E+00
8.06191440232750E+00 5.82244841863038E+00 4.95787603533274E+00
5.04638324236482E+00 8.33705252525774E+00 7.32433413587005E+00
2.04108475715077E+00 5.82001901588952E+00 5.05415800574768E+00
5.13925614436763E+00 8.40867652716315E+00 2.75714159286964E+00
2.61800142894251E+00 1.77738175002289E+00 5.02054486805876E+00
4.94928280233908E+00 4.07302530110812E+00 2.01973663276942E+00
7.22636291779700E+00 1.72292369993206E+00 5.01056990979596E+00
OCHO
5.04984575451512E+00 4.16899949437203E+00 8.38913015254607E+00
8.41311365271435E+00 5.90089795783486E+00 4.95471182062348E+00
5.03415065613991E+00 8.59685365002286E+00 7.55813423208373E+00
1.74698681832614E+00 5.90648520608937E+00 5.06338313646141E+00
5.18293202209829E+00 8.65797235431727E+00 2.55146839659064E+00
2.37498157493418E+00 1.52435602504604E+00 5.05472507160296E+00
4.94013649443927E+00 3.99148837619247E+00 1.70888099796613E+00
7.45281058614491E+00 1.44078631178572E+00 5.02800797156495E+00
5.06121397319380E+00 4.12058032588327E+00 8.68447945343327E+00
8.72702972867216E+00 5.97125344607309E+00 4.95356174377168E+00
5.02853185579037E+00 8.82735666386533E+00 7.78573599371909E+00
1.49572020273345E+00 5.99391275314096E+00 5.06982138334711E+00
5.21922310707857E+00 8.88757063849985E+00 2.36236099078587E+00
2.13898312096346E+00 1.27787829294346E+00 5.08900607800080E+00
4.93737798070308E+00 3.92065650633274E+00 1.45340060600900E+00
7.66219575537295E+00 1.17896720121153E+00 5.04410388655584E+00
5.07797828387780E+00 4.08080474548203E+00 8.86062092660662E+00
8.92790713427544E+00 6.01972706387360E+00 4.95639755111023E+00
5.01696025227494E+00 9.02715627759038E+00 8.00002249576090E+00
1.35384197118449E+00 6.08692117177528E+00 5.08473103672434E+00
5.25890722173210E+00 9.07644460069736E+00 2.19213416384504E+00
1.93720762154327E+00 1.04452684624935E+00 5.12834330393892E+00
4.93616876462326E+00 3.86635176118538E+00 1.31277147702432E+00
7.86411891303825E+00 9.36328546679487E-01
5.05737978263407E+00
This is what i did last night.
$count=$count+1;
$outfile = $output_directory."/".$infile."_".$count;
#****************************************************
while(<INFILE>) {
open (OUTFILE, ">>$outfile") || die "no se puede abrir $outfile para escribir";
print OUTFILE "$_";
last if ($_ =~ /OCHO/);
close OUTFILE;
}
close INFILE;
But this just print 1 blcok to 1 file..OCHO is just a string to finish the loop.\
Any advice?
this is the input file to work:
5.04786152982032E+00 4.23000449311482E+00 8.04732158465680E+00
8.06191440232750E+00 5.82244841863038E+00 4.95787603533274E+00
5.04638324236482E+00 8.33705252525774E+00 7.32433413587005E+00
2.04108475715077E+00 5.82001901588952E+00 5.05415800574768E+00
5.13925614436763E+00 8.40867652716315E+00 2.75714159286964E+00
2.61800142894251E+00 1.77738175002289E+00 5.02054486805876E+00
4.94928280233908E+00 4.07302530110812E+00 2.01973663276942E+00
7.22636291779700E+00 1.72292369993206E+00 5.01056990979596E+00
OCHO
5.04984575451512E+00 4.16899949437203E+00 8.38913015254607E+00
8.41311365271435E+00 5.90089795783486E+00 4.95471182062348E+00
5.03415065613991E+00 8.59685365002286E+00 7.55813423208373E+00
1.74698681832614E+00 5.90648520608937E+00 5.06338313646141E+00
5.18293202209829E+00 8.65797235431727E+00 2.55146839659064E+00
2.37498157493418E+00 1.52435602504604E+00 5.05472507160296E+00
4.94013649443927E+00 3.99148837619247E+00 1.70888099796613E+00
7.45281058614491E+00 1.44078631178572E+00 5.02800797156495E+00
5.06121397319380E+00 4.12058032588327E+00 8.68447945343327E+00
8.72702972867216E+00 5.97125344607309E+00 4.95356174377168E+00
5.02853185579037E+00 8.82735666386533E+00 7.78573599371909E+00
1.49572020273345E+00 5.99391275314096E+00 5.06982138334711E+00
5.21922310707857E+00 8.88757063849985E+00 2.36236099078587E+00
2.13898312096346E+00 1.27787829294346E+00 5.08900607800080E+00
4.93737798070308E+00 3.92065650633274E+00 1.45340060600900E+00
7.66219575537295E+00 1.17896720121153E+00 5.04410388655584E+00
5.07797828387780E+00 4.08080474548203E+00 8.86062092660662E+00
8.92790713427544E+00 6.01972706387360E+00 4.95639755111023E+00
5.01696025227494E+00 9.02715627759038E+00 8.00002249576090E+00
1.35384197118449E+00 6.08692117177528E+00 5.08473103672434E+00
5.25890722173210E+00 9.07644460069736E+00 2.19213416384504E+00
1.93720762154327E+00 1.04452684624935E+00 5.12834330393892E+00
4.93616876462326E+00 3.86635176118538E+00 1.31277147702432E+00
7.86411891303825E+00 9.36328546679487E-01
5.05737978263407E+00
This is what i did last night.
$count=$count+1;
$outfile = $output_directory."/".$infile."_".$count;
#****************************************************
while(<INFILE>) {
open (OUTFILE, ">>$outfile") || die "no se puede abrir $outfile para escribir";
print OUTFILE "$_";
last if ($_ =~ /OCHO/);
close OUTFILE;
}
close INFILE;
But this just print 1 blcok to 1 file..OCHO is just a string to finish the loop.\
Any advice?