Student Database using AWK Programming
Write a program to handle student data base with options given below
a) Create data base.
b) View Data Base.
c) Insert a record.
d) Delete a record.
e) Modify a record.
f) Result of a particular student.
g) Exit.
Student Database using AWK
clear echo "1. create database " echo "2. view database " echo "3. insert a record " echo "4. delete record " echo "5. modify a record " echo "6. result of particular student " echo "7. exit" echo " enter ur choice " read d case $d in 1) echo " enter rollnumber of student " read rn echo " enter name of student " read nm echo " enter marks sanskrit " read sk echo " enter marks english " read eg echo " enter marks hindi " read hn record="$rn :$nm: $sk: $eg: $hn " awk 'BEGIN{ print "'"$record"'">"stud" }' ;; 2) awk 'BEGIN{print "rollno name smarks emarks hmarks"}{print $0}' stud;; 3) echo " enter rollnumber of student " read rn echo " enter name of student " read nm echo " enter marks sanskrit " read sk echo " enter marks english " read eg echo " enter marks hindi " read hn record="$rn: $nm: $sk: $eg: $hn " awk 'BEGIN { print "'"$record"'">>"stud" }' ;; 4) echo " enter roll number " read rn awk 'BEGIN{FS=":"}$1=='$rn' {print }' stud echo "RECORD FOUND " awk 'BEGIN{FS=":"}$1!='$rn'{print >"temp"}' stud cp temp stud ;; 5) echo " enter roll number " read rn1 awk 'BEGIN{FS=":"}$1=='$rn1' {print }' stud echo " enter roll number " read rn echo " enter name of student " read nm echo " enter marks sanskrit " read sk echo " enter marks english " read eg echo " enter marks hindi " read hn record="$rn: $nm: $sk: $eg: $hn " var=`awk 'BEGIN{FS=":"}$1=='$rn1' {print NR}' stud ` echo $var awk 'BEGIN{FS=":"}NR<'$var'{print >"temp"}' stud echo $record>>temp var3=`awk 'END{print NR}' stud ` var2=`expr $var3 - $var ` awk 'BEGIN{FS=":"}NR>'$var2' && NR<'var3' {print >>"temp"}' stud cp temp stud ;; 6) echo " enter roll number " read rn echo "printing result " awk 'BEGIN{FS=":"}$1=='$rn' {print }' stud echo "RECORD FOUND " ;; 7) ;; * ) echo "enter right choice" esac
Rambo says
Yes , you can Execute it in Ubuntu also
Rambo says
Try on MINT Gloria …!!
Anonymous says
in ubuntu u cant execute awk!! 🙂
Anonymous says
i am using ubuntu..
my problem and question is the same as the above post.
reply awaited.
thnx!
Vighnesh says
Thnx .. Amigo.