Find The Max And Min With Awk In Specific Range
Hi,
I have file with three columns , I want to get max of $3 and min of $2 but in specific range of $1 with AWK
Col1 Col2 Col3
X 1 2
X 3 4
Y 5 6
Y 7 8
I want to get Min value of Col2 , Max value of Col3 while Col1=X I could handle max and min value but I dont find out how to find it in specific range this is my code :
awk ' min==""; || $2 < min {min=$2; minline=$0} $3 > max {max=$3; maxline=$0};END {print $1,min,max}'
I tried to add {If ($1==X)} but It doesnt work well.
And suggestion ?
• 499 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Is there some bioinformatics research relevance to this question? As it stands, it is a basic programming problem, better asked at stackoverflow.com. Also, the wording is not very clear.
Thanks, I remove my question here ,
Best