Apply if condition to all lines of tab delim which have same value in a particular column:

Apply if condition (in column 3rd ) to all lines of tab delim which have same value in a particular column (in this case column2)

Input:

id1 Disease1 High

id2 Disease1 Medium
id3 Disease1 Low
id4 Disease2 Low
id5 Disease3 Medium
id6 Disease3 Low

***
Expected output

id1 Disease1 High
id4 Disease2 Low
 id5 Disease3 Medium

Welcome to the forum.

What "if condition (in column 3rd )" do you want applied? Not clear from your expected output. Please rephrase your request.

Basically I want to apply if condition in lines which have same value in column2. In example first three lines have same value in column2 (Disease1 ) , now for these three line i want to aplly IF condition- if 3rd column is HIGH write only that line to output file , if 3rd column doesn't have HIGH, then look for MEDIUM and print it, if MEDIUM is also not there , then print line containing LOW value. Hope I have not confused it more

Why don't you phrase your request more specifically, like you did in shell - Apply if condition to all lines of a tab delim file which have same value in a particular column: - Unix & Linux Stack Exchange