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