#!/usr/bin/perl -w


if(@ARGV !=2){
    print "format:remove_breakline.pl input.txt output.txt k\n";
    print "Please specify the names of the input file and the output file\n"; 
    exit 1;
}

$infile1=shift;  #idio me $infile=$ARGV[0]
#idio me $outfile= $ARGV[1]
$outfile=shift;
$k=0;
open(IN, "$infile1") || die "Cannot open: $!\n";

open(OUT, ">$outfile") || die "Cannot open: $!\n";
$first=1;
    while($line=<IN>){
	if ($line=~m/^>(.*)/){
	    if($first==1){
		$first=0;
	    }
	    else{
		print OUT "\n";
	    }
	    print OUT $line;
	}
	else{
	    chomp( $line);
	    $k++;
#$line=~ s/\n//s;
	    print OUT $line;
	    next $line if($line=~m/^>(.*)/);
#print OUT " \n" ;
	}
}

close(OUT);
close(IN);
