File: remove_breakline.pl

package info (click to toggle)
kissplice 2.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,752 kB
  • sloc: cpp: 8,783; python: 1,618; perl: 389; sh: 72; makefile: 18
file content (39 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/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);