Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Read lines from input file – print lines that match a regular expression

  • Public
By Nishi Singh 3152 days ago
#!/usr/bin/perl use strict; use warnings; my $line; #read the line-by-line for each line ask if it matches the regex print it if it matches while($line = <DATA>){ chomp $line; if ($line =~ /^ATG?C*[ATCG]+?A{3,10}$/) { print "$line\n"; } } exit(); __DATA__ ATGCCCAA ATGCCCAAAA ATGCCCAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD