User talk:Nanda8585


 * } Mean as custard (talk) 07:44, 6 May 2011 (UTC)

unix code1
enter any more (y/n)?\c n [c2718@SMB3A ~]$ cat employeedatabase 1 : nandu : asst : s/w : 03 : 2011 : 30000 : blre : active : :  :  :  :  :  :  : [c2718@SMB3A ~]$ vi masteremployeedatabase echo "enter 3 for report generation" read option case $option in 1) tail -1 employeedatabase | tee previousEid set `cut -c 1-2 previousEid` tmpid=$1 echo $tmpid echo  "please enter the employee no more then 1 from given eno  " read empno while [ $empno -le $tmpid ] do echo  "please enter the employee no more then 1 from given eno  " read empno done echo  "enter the employee name" read ename echo  "enter the degignation" read desig echo  "enter the departmentno" read dno echo  "enter the month of joining" read jmonth echo  "enter the year of joining" read jyr echo  "enter the salary" read sal echo  "enter the employee address" read eaddress echo  "enter the employee status" read status echo "$empno : $ename : $desig : $dno : $jmonth : $jyr : $sal : $eaddress : $status" >> employeedatabase ;;   2) ;; *) ;; esac echo "enter any more (y/n)?\c" read anymore case $anymore in y|Y)ans=y ;; n|N)ans=n ;;  *)ans=y;; esac done
 * 1) paste previousEid

unix code1
enter any more (y/n)?\c n [c2718@SMB3A ~]$ cat employeedatabase 1 : nandu : asst : s/w : 03 : 2011 : 30000 : blre : active : :  :  :  :  :  :  : [c2718@SMB3A ~]$ vi masteremployeedatabase echo "enter 3 for report generation" read option case $option in 1) tail -1 employeedatabase | tee previousEid set `cut -c 1-2 previousEid` tmpid=$1 echo $tmpid echo  "please enter the employee no more then 1 from given eno  " read empno while [ $empno -le $tmpid ] do echo  "please enter the employee no more then 1 from given eno  " read empno done echo  "enter the employee name" read ename echo  "enter the degignation" read desig echo  "enter the departmentno" read dno echo  "enter the month of joining" read jmonth echo  "enter the year of joining" read jyr echo  "enter the salary" read sal echo  "enter the employee address" read eaddress echo  "enter the employee status" read status echo "$empno : $ename : $desig : $dno : $jmonth : $jyr : $sal : $eaddress : $status" >> employeedatabase ;;   2) ;; *) ;; esac echo "enter any more (y/n)?\c" read anymore case $anymore in y|Y)ans=y ;; n|N)ans=n ;;  *)ans=y;; esac done
 * 1) paste previousEid

Case Study for shell scripting Write a shell which accepts a flat file, interpret the type of file and do the required operation. Use functions for every operation Operations include:- - Adding new employees to the master employee file with info from a file - Marking employee status as “quit” in master employee file with info from a file i.e. employees who have quit the organization. - Update employee info from master employee file with info from a file - Identify the location of the employee and add or update or delete info from the location file also - In case of transfer move info from one location file to the other location file also Other features:- - Increment the days of employment in the corresponding field in the employee file everyday - Generate a report for the admin with the following info a) New employees b) Transferred employees c) Employees who have quit - Check before processing for the availability of the file in the directory Can include:- - Employee id can be generated, instead of being a part of the file - Can have separate files for all the employees and update info in those files also. Useful Commands:- 1) read 2) sed 3) awk 4) for, while, if, case 5) test 6) Redirection operators 7) Wildcard characters 8) grep Master employee file:- Emp.no name desgn. Project location status Note:- Make suitable assumptions as needed.