Perl_Line_Picker


Line_Picker.pl => Average execution time: Few seconds for a file with >20000 lines
Input file: Text file with non-homogeneous entries separated by tab character
Output desired: Text file only with desired number of entries in each line

1:  open(out, ">Output_file.txt");  
2:  open(infile, "Input_File.txt");  
3:       while(<infile>)  
4:       {  
5:            @line = split /\s+/;  
6:            $num = scalar @line;  
7:            if($num > 4 && $num < 101){ print out "@line\n";}  
8:       }  
9:  print "Program complete\n";  
Example Input:
1. A  B  C  D
2. E   F  G
3. H

Example Output: (Only lines with > 1 entry)
A  B  C  D
E  F  G

Comments

Popular posts from this blog

Condense fasta header

Map multiple annotations using pandas

Fasta Header Replacer