Kytcs.Blogspot.com: UNIX CODING ANSWER 12 JUNE

UNIX CODING ANSWER 12 JUNE

UNIX CODING ANSWER 12 June



#!/bin/bash

#Write your commands here

read 

awk 'BEGIN{
FS=",";

cnt=0

{a[cnt]=$1;
d[cnt]=$3;
e[cnt]=$4;
b[cnt]=($3+$4)/2;

c[cnt]=$2;
 
cnt=cnt+1
 
}
END{
for(i=0;i<cnt;++i)
{   ma=0;
    pos=i;
    for(j=0;j<cnt;++j)
    {
        if (b[j]>ma)
        {
            ma=b[j];
            pos=j;
        }
    }
    if (b[pos]>=75 && d[pos]>50 && e[pos]>50)
    print a[pos],c[pos],b[pos];
    b[pos]=-1;
 
}
}
'

No comments:

Post a Comment

Followers

Ad Space