Hi Everyone,
I have a file something like this:
chr10 180833 225933 1 1 0 1 0 16
chr10 181144 225933 1 1 0 2 0 13
chr10 181243 225933 1 1 0 4 0 32
chr10 181500 225933 1 1 0 5 0 34
chr10 196199 196457 1 1 0 1 0 31
chr10 226069 243850 1 1 0 1 0 25
chr10 226069 255828 1 1 0 32 0 37
chr10 255989 267134 1 1 0 24 0 33
chr10 255989 282777 1 1 0 13 0 38
chr10 267297 282777 1 1 0 33 0 38
I want to write a script in perl where I can print out those lines in which column 7 is greater than 10.
my code is as follows:
while(<>){
chomp;
my @s = split /\t/,$_;
my $count = $s[6];
if($count > 10){
print $_,"\n";
}
}
What i want to do is use Getopt::Long module and make a flag --unique so that I can feed any value to that flag let's say 2 or 4 or 10 etc and it prints the line fulfilling the condition. How can I do that?
Thanks
Varun
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.