User talk:Lallan sharma

master file
01|Gunpreet Singh Kohli |C.E.O |Banking |Delhi|Active |104| 02|Harpreet Singh |Senior Manager | Banking |Delhi|Active |189| 03|Digvijay Singh Sengar |Sales |Govt |Chennai|Active |494| 04|Lalu Yadav |Sales |Insurance |Delhi|Active |318| 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 |ASE |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 |Kanpur|Active |100| 19|Devi Gilchrist |Sales |Banking |Mumbai|Active |032| 20|Rajat John Singh |Manager |Telecom |Chennai|Acitve |042|

updated file
02|Harpreet Singh |Senior Manager | Banking |Delhi|Active |189| 04|Lalu Yadav |Sales |Insurance |Delhi|Active |318| 10|Shahrukh Khan |ASE |Banking |Delhi|Active |036| 18|Ankur Anderson |Trainee |Telecom |Kanpur|Active |100|

logic for updating : updateEmployeeInfo
for i in `cut -d"|" -f 1 updatedfile.txt` do echo " value of $i"; val=`grep "^$i|" masterfile.txt | wc -l`; if test $val -eq 1 then grep -v "^$i|" masterfile.txt > unupdatedrows; grep "^$i|" updatedfile.txt >> unupdatedrows; sort -n unupdatedrows > masterfile.txt; fi done cat masterfile.txt;

set location file
for i in `cut -d"|" -f 5 masterfile.txt` do echo " Location is $i"; val=`grep "$i|" masterfile.txt | wc -l`; echo "no. of employees in $i are $val." if test $val -ge 1 then grep "$i" masterfile.txt > $i; fi done