#!/usr/bin/perl

open(infile,"septum_12-09-11_trim1.dat");

open(outfile1,">septum_12-09-11_iter1.dat");
open(outfile2,">septum_12-09-11_iter2.dat");
open(outfile3,">septum_12-09-11_iter3.dat");
open(outfile4,">septum_12-09-11_iter4.dat");
open(outfile5,">septum_12-09-11_iter5.dat");

while(<infile>){
    $line = $_;
    chomp($line);
    @data = split(/\s+/,$line);
    print "$data[1]\n";
    if ($data[1]>1323.4678e6 && $data[1]<1323.4732e6) {print outfile1 "$line\n ";}
    elsif ($data[1]>1323.4735e6 && $data[1]<1323.4755e6) {print outfile2 "$line\n ";}
    elsif ($data[1]>1323.4754e6 && $data[1]<1323.4766e6) {print outfile3 "$line\n ";}
    elsif ($data[1]>1323.4766e6 && $data[1]<1323.47794e6) {print outfile4 "$line\n ";}
    elsif ($data[1]>1323.4779e6 && $data[1]<1323.4792e6) {print outfile5 "$line\n ";}
}

close(infile);
close(outfile1);
close(outfile2);
close(outfile3);
close(outfile4);
close(outfile5);

