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 2
Using a perl one-liner
perl -ane 'print if $. == 1 || grep {$_ > 50} @F[1..$#F]' file.txt
Switches:
-a
: Splits the line on space and loads them in an array @F
-n
: Creates a while(<>){...}
loop for each “line” in your input file. -e
: Tells perl
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. ||
: Logical OR
operator. If any of our above stated condition is true, it prints the line.