Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i=1;
- j=1;
- echo -n "Enter Database Name : "
- read jdg
- while [ $i = 1 ]
- do
- echo "-----------------------------------"
- echo "1. Add Judge Record."
- echo "2. View Judge Record."
- echo "3. Find Highest Case."
- echo "4. Calculate Total Case Of Court "Ahmedabad"."
- echo "5. List Judge Names."
- echo "6. Update Judge Record."
- echo "7. Exit."
- echo "-----------------------------------"
- echo -n "Enter Choose : "
- read ch
- case $ch in
- 1) #Add_Record
- echo -n "Judge_Name : "
- read jd_name;
- echo -n "Court_Name : "
- read crt_name;
- echo -n "Court_City : "
- read crt_city;
- echo -n "Case_Of_Judge : "
- read cas_judge;
- echo -n "Total_Case : "
- read ttl_case;
- #must see this format other wise cannot work awk command
- echo "$jd_name | $crt_name | $crt_city | $cas_judge | $ttl_case" >> $jdg;
- ;;
- 2) #Display_List
- sort -n -k1 $jdg;
- ;;
- 3) #Find Highest Case.
- sort --reverse -n -k 4 $jdg > sortname.txt
- head -1 sortname.txt > headjudge.txt
- cut -d "|" -f1,4 headjudge.txt
- ;;
- 4) #Calculate Total Case Of Court "Ahmedabad"
- #use store data in textfile for must see text file save format.
- #use this sign must use Space any other operator Ex. " | " other wise awk command not work.
- grep -i "Ahmedabad" $jdg > textcity.txt
- awk '{s+=$9}END{print s}' textcity.txt
- ;;
- 5) #List Judge Name
- cut -d "|" -f1 $jdg > JudgeName.txt
- cat JudgeName.txt
- ;;
- 6) #Update_Command
- sort -n -k1 $jdg;
- echo -n "Enter Judge_Name : "
- read n;
- grep -i "$n" $jdg | tee x;
- wc -c x | tee y;
- a=`cut -d " " -f 1 y`
- if [ "$a" = 0 ]
- then
- echo "Record not found"
- else
- echo -n "Judge_Name : "
- read jd_name;
- echo -n "Court_Name : "
- read crt_name;
- echo -n "Court_City : "
- read crt_city;
- echo -n "Case_Of_Judge : "
- read cas_judge;
- echo -n "Total_Case : "
- read ttl_case;
- grep -v "$n" $jdg | cat > def;
- cat def | tee $jdg;
- echo "$jd_name|$crt_name|$crt_city|$cas_judge|$ttl_case" >> $jdg;
- sort -n -k1 $jdg;
- fi
- ;;
- *) exit
- ;;
- esac
- echo -n "Do You Want To Conti...?"
- read i
- echo "-----------------------------------"
- if [ $i = 0 ]
- then
- exit
- fi
- done
Add Comment
Please, Sign In to add comment