clear
ch==1
echo "Sorting a Database"
echo "-------------------"
echo "Enter the Databse Name"
read fn
echo "Content of the File"
cat $fn
echo "Before Sorting"
echo "---------------"
echo ""
echo "USN Name SEM/BRANCH SEX DOB"
echo "---- ----- ------------- ---- ----"
cat $fn
echo ""
echo "After Sorting"
echo "-------------"
echo ""
echo "USN NAME SEM/BRANCH SEX DOB"
echo "---- ----- ------------- ---- ---"
sort -t\| +1 -2 $fn
echo ""
-----------
OUTPUT:
-----------
Sorting a Database
-------------------
Enter the Database Name
stud
Content of the file
------------------
ISO23 |rashmi bangera |V ISE |F |03/09/85
ISO38 |b h yatheesh |V ISE |M |03/02/85
CSO18 |karthik iyer |V CSE |M |02/05/84
CSO24 |Sourab guptha |V CSE |M |01/06/84
ISO06 |ashish rastagi |V ISE |M |03/07/84
CSO55 |vaishnavi sargod |V CSE |F |02/11/85
ISO17 |Poorvi prasad |V ISE |F |11/01/84
Before Sorting
---------------
USN NAME SEM/BRANCH SEX BOB
---- ------ ------------- ---- ----
ISO23 |rashmi bangera |V ISE |F |03/09/85
ISO38 |b h yatheesh |V ISE |M |03/02/85
CSO18 |karthik iyer |V CSE |M |02/05/84
CSO24 |Sourab guptha |V CSE |M |01/06/84
ISO06 |ashish rastagi |V ISE |M |03/07/84
CSO55 |vaishnavi sargod |V CSE |F |02/11/85
ISO17 |Poorvi prasad |V ISE |F |11/01/84
After Sorting
-------------
USN NAME SEM/BRANCH SEX BOB
---- ------ ------------- ---- ----
ISO06 |ashish rastagi |V ISE |M |03/07/84
ISO38 |b h yatheesh |V ISE |M |03/02/85
CSO18 |karthik iyer |V CSE |M |02/05/84
ISO17 |Poorvi prasad |V ISE |F |11/01/84
ISO23 |rashmi bangera |V ISE |F |03/09/85
CSO24 |Sourab guptha |V CSE |M |01/06/84
CSO55 |vaishnavi sargod |V CSE |F |02/11/85
ch==1
echo "Sorting a Database"
echo "-------------------"
echo "Enter the Databse Name"
read fn
echo "Content of the File"
cat $fn
echo "Before Sorting"
echo "---------------"
echo ""
echo "USN Name SEM/BRANCH SEX DOB"
echo "---- ----- ------------- ---- ----"
cat $fn
echo ""
echo "After Sorting"
echo "-------------"
echo ""
echo "USN NAME SEM/BRANCH SEX DOB"
echo "---- ----- ------------- ---- ---"
sort -t\| +1 -2 $fn
echo ""
-----------
OUTPUT:
-----------
Sorting a Database
-------------------
Enter the Database Name
stud
Content of the file
------------------
ISO23 |rashmi bangera |V ISE |F |03/09/85
ISO38 |b h yatheesh |V ISE |M |03/02/85
CSO18 |karthik iyer |V CSE |M |02/05/84
CSO24 |Sourab guptha |V CSE |M |01/06/84
ISO06 |ashish rastagi |V ISE |M |03/07/84
CSO55 |vaishnavi sargod |V CSE |F |02/11/85
ISO17 |Poorvi prasad |V ISE |F |11/01/84
Before Sorting
---------------
USN NAME SEM/BRANCH SEX BOB
---- ------ ------------- ---- ----
ISO23 |rashmi bangera |V ISE |F |03/09/85
ISO38 |b h yatheesh |V ISE |M |03/02/85
CSO18 |karthik iyer |V CSE |M |02/05/84
CSO24 |Sourab guptha |V CSE |M |01/06/84
ISO06 |ashish rastagi |V ISE |M |03/07/84
CSO55 |vaishnavi sargod |V CSE |F |02/11/85
ISO17 |Poorvi prasad |V ISE |F |11/01/84
After Sorting
-------------
USN NAME SEM/BRANCH SEX BOB
---- ------ ------------- ---- ----
ISO06 |ashish rastagi |V ISE |M |03/07/84
ISO38 |b h yatheesh |V ISE |M |03/02/85
CSO18 |karthik iyer |V CSE |M |02/05/84
ISO17 |Poorvi prasad |V ISE |F |11/01/84
ISO23 |rashmi bangera |V ISE |F |03/09/85
CSO24 |Sourab guptha |V CSE |M |01/06/84
CSO55 |vaishnavi sargod |V CSE |F |02/11/85
0 comments:
Post a Comment