top of page

OPA May 15 Unix 

.

Input:

ItemID,ItemName,Item Price
1,kumar,20
2,suresh,400
3,ramesh,14
4,karthick,53
5,surya,14
6,Dinesh,14

 

Output: 

3

 

Solutions:

read 
awk 'BEGIN{FS=",";choice;count;i}
     { if(NR==1) 
       {choice=$3;a[i++]=$3}
       else{
            a[i++]=$3;
            if(choice>$3) {choice=$3;}
            }
    }
    END{ for(j=0;j<i;j++)
        {
           if(a[j]==choice){
             count++;
            }
        }
        {print count}
    }'

Try the code in online compiler - > click here

Know your TCS: Services

©2018 by The real one. Proudly created with Wix.com

bottom of page