User talk:Lahaurisrock
New Employees
1|Chandra Mohan|Manager |Banking |Delhi |Active|
2|Dipanshu Wahi|Sales |Telecom |Mumbai |Active| 3|Gyanendra |Trainee |Govt |Kanpur |Active| 4|Suneeta |Production |Insurence|Chennai |Active| 5|Laxman Singh |Trainee |Banking |Kanpur |Active| 6|Laxmi Kant |manager |Telecom |Mumbai |Active| 7|Kuldeep Singh|production |Govt |Chennai |Active| 8|Shyam |Sales |Insurence|Mumbai |Active| 9|Shalini |Sales |Banking |Kanpur |Active|
10|Sandeep Soni |Production |Govt |Delhi |Active|
Add employees
- index=1
- cat newemployee
- echo "Check point1"
- wc -l newemployee
- echo "Check point 2"
employeeid=`wc -l < masterfile`
- echo "Check point 3"
- echo "Record Count = $recordcount"
- echo "Starting for loop"
- lines=`cat newemployee`
- set $lines
for i in {1..100}
do #grep "$i" newemployees > stringfile #sed -n '/^/$i*$/p' newemployees > stringfile awk -F"|" -v pin=$i 'NR == pin {print}' newemployees > stringfile #echo "Displaying String file" #cat stringfile if [ $? = 0 ] then #cat stringfile index=1 temp=`expr $employeeid + $index` employeeid=$temp #echo "Employee id =$employeeid" awk -F"|" -v a=$employeeid '{printf "%d|%-25s|%-11s|%-12s|%-9s|%-8s|001|",a,$2,$3,$4,$5,$6}' stringfile > tempfile #cat tempfile cat tempfile >> tempmasterfile echo -e "\n" >> tempmasterfile fi
done sed '/^[ ]*$/d' tempmasterfile > tempfile cat tempfile > tempmasterfile
echo "Welcome To Employee Management System"
echo -e "\n"
echo -e "\n"
answer="y"
while [ "$answer" = "y" ]
do echo "Menu" echo "1.Check Employee Database" echo "Enter your option" read option case $option in 1) cat masterfile ;; *) echo "Incorrect Option Selected" esac
echo "Do you want to continue" read answer
case $answer in [yY]*) answer=y ;; [Nn]*) answer=n esac
done
Master file
01|Gunpreet Singh Kohli |C.E.O |Banking |Delhi |Active |104| 02|Harpreet Singh |Manager |Telecom |Mumbai |Active |185| 03|Digvijay Singh Sengar |Sales |Govt |Chennai |Active |494| 04|Lalu Yadav |Sales |Telecom |Delhi |Active |228| 05|Baby Sharma |Manager |Banking |Mumbai |Acitve |572| 06|Arpit Thakur |Chairman |Insurance |Kanpur |Active |024| 07|Sonal Rajab |Production |Insurance |Delhi |Active |018| 08|Altaf Sharma |Trainee |Govt |Mumbai |Active |057| 09|M.D Aziz |Sales |Insurance |Mumbai |Active |632| 10|Shahrukh Khan |Production |Banking |Delhi |Active |036| 11|Sanjay Mishra |Manager |Telecom |Mumbai |Active |016| 12|Preeti Bedi |Trainee |Govt |Kanpur |Active |342| 13|Pappu Khan |Sales |Telecom |Chennai |Active |634| 14|Divya Soni |Manager |Bannking |Delhi |Active |077| 15|Johny Singh |Trainee |Banking |Kanpur |Active |003| 16|Silvia Sharma |Production |Govt |Kanpur |Active |026| 17|Mark Mohomad |Production |Govt |Delhi |Active |724| 18|Ankur Anderson |Trainee |Telecom |Chennai |Active |062| 19|Devi Gilchrist |Sales |Banking |Mumbai |Active |032| 20|Rajat John Singh |Manager |Telecom |Chennai |Acitve |042|
Temp Masterfile
01|Gunpreet Singh Kohli |C.E.O |Banking |Delhi |Active |104| 02|Harpreet Singh |Manager |Telecom |Mumbai |Active |185| 03|Digvijay Singh Sengar |Sales |Govt |Chennai |Active |494| 04|Lalu Yadav |Sales |Telecom |Delhi |Active |228| 05|Baby Sharma |Manager |Banking |Mumbai |Acitve |572| 06|Arpit Thakur |Chairman |Insurance |Kanpur |Active |024| 07|Sonal Rajab |Production |Insurance |Delhi |Active |018| 08|Altaf Sharma |Trainee |Govt |Mumbai |Active |057| 09|M.D Aziz |Sales |Insurance |Mumbai |Active |632| 10|Shahrukh Khan |Production |Banking |Delhi |Active |036| 11|Sanjay Mishra |Manager |Telecom |Mumbai |Active |016| 12|Preeti Bedi |Trainee |Govt |Kanpur |Active |342| 13|Pappu Khan |Sales |Telecom |Chennai |Active |634| 14|Divya Soni |Manager |Bannking |Delhi |Active |077| 15|Johny Singh |Trainee |Banking |Kanpur |Active |003| 16|Silvia Sharma |Production |Govt |Kanpur |Active |026| 17|Mark Mohomad |Production |Govt |Delhi |Active |724| 18|Ankur Anderson |Trainee |Telecom |Chennai |Active |062| 19|Devi Gilchrist |Sales |Banking |Mumbai |Active |032| 20|Rajat John Singh |Manager |Telecom |Chennai |Acitve |042| 21|Chandra Mohan |Manager |Banking |Delhi |Active |001| 22|Dipanshu Wahi |Sales |Telecom |Mumbai |Active |001| 23|Gyanendra |Trainee |Govt |Kanpur |Active |001| 24|Suneeta |Production |Insurence |Chennai |Active |001| 25|Laxman Singh |Trainee |Banking |Kanpur |Active |001| 26|Laxmi Kant |manager |Telecom |Mumbai |Active |001| 27|Kuldeep Singh |production |Govt |Chennai |Active |001| 28|Shyam |Sales |Insurence |Mumbai |Active |001| 29|Shalini |Sales |Banking |Kanpur |Active |001| 30|Sandeep Soni |Production |Govt |Delhi |Active |001| 21|Chandra Mohan |Manager |Banking |Delhi |Active |001| 22|Dipanshu Wahi |Sales |Telecom |Mumbai |Active |001| 23|Gyanendra |Trainee |Govt |Kanpur |Active |001| 24|Suneeta |Production |Insurence |Chennai |Active |001| 25|Laxman Singh |Trainee |Banking |Kanpur |Active |001| 26|Laxmi Kant |manager |Telecom |Mumbai |Active |001| 27|Kuldeep Singh |production |Govt |Chennai |Active |001| 28|Shyam |Sales |Insurence |Mumbai |Active |001| 29|Shalini |Sales |Banking |Kanpur |Active |001| 30|Sandeep Soni |Production |Govt |Delhi |Active |001|
Location
[edit]01|Delhi|Chennai 04|Delhi|Mumbai 25|Kanpur|Delhi 12|Kanpur|Chennai 27|Chennai|Mumbai 19|Mumbai|Delhi 20|Chennai|Mumbai
Location change
[edit]count=`wc -l < location` echo "lince count=$count" index=1 while [ $index -le $count ]
do awk -F"|" -v temp=$index 'NR == temp { print }' location var=`expr $index + 1` index=$var done