How to select those lines which have a value < 10 value from a large matrix of 21 columns and 150 rows.eg.
miRNameIDs degradome AGO LKM......till 21
osa-miR159a 0 42 42
osa-miR396e 0 7 9
vun-miR156a 121 77 4
ppt-miR156a 12 7 4
gma-miR6300 118 2 0
bna-miR156a 0 114 48
gma-miR156k 0 46 1
osa-miR1882e 0 7 0
.
.
.
Desired output is:-
miRNameIDs degradome AGO LKM......till 21
vun-miR156a 121 77 4
gma-miR6300 118 2 0
bna-miR156a 0 114 48
.
.
.
till 150 rows
Using a perl one-liner
Explanation:
Switches:
-a
: Splits the line on space and loads them in an array@F
-n
: Creates awhile(<>){...}
loop for each “line” in your input file.-e
: Tellsperl
to execute the code on command line.Code:
$. == 1
: Checks if the current line is line number 1.grep {$_ > 50} @F[1..$#F]
: Looks at each entries from the array to see if it is greater than 50.||
: LogicalOR
operator. If any of our above stated condition is true, it prints the line.