8. create an emp file containing empname, empno, dept and designation. a. display empname and empno of any particular dept and the count of employees. b. display empname and empno of employees who are not managers.

while [ 1 ]                                                           
do                                                                    
        echo "enter the choice"                                       
        read choice
                                                  
case $choice in                                                       
1)     echo "enter emp id, name, dept and designation"                    
       read sid name dept designation                                      
       echo "$sid $name $dept $designation" >> emp;;  

2)      echo "display empname and empno of a particular dept and count of employees"                         
        echo "enter the dept"                                              
       read dept  
                                                       
       grep $dept emp | cut -d " " -f 1,2                                  
       grep $dept emp | echo "count of employee in $dept=`wc -l`";;
        
3)     echo "display empname and empno of employee who are not managers"  
        awk '$4!~"managers"{printf("%d\t %s\n",$1,$2)}' emp;; 
           
4)     exit;;                                                             
esac                                                                  
done

No comments

Powered by Blogger.