Friday, 19 September 2014

OSA:[Grp B-15] CONVERT FILE INFO INTO LOWER/UPPER CASE

while true

do

echo "1.Create files :";
echo "2.To Upper :";
echo "3.To Lower";
echo "4.Exit";

echo "Enter your choice : ";

read ch;
case $ch in
1)

echo "Please enter File1 name : ";
read dirr;
touch $dirr.txt
chmod 777 $dirr.txt


echo "Open and write into $dirr.txt file manually"

;;
2)
echo "Upper Case is: ";
tr '[a-z]' '[A-Z]' < $dirr.txt
#tr '[:lower:]' '[:upper:]' < $dirr.txt



;;
3)
echo "Lower Case is: ";
tr '[A-Z]' '[a-z]' < $dirr.txt
#tr '[:upper:]' '[:lower:]' < $dirr.txt

;;

4)
exit 0;
;;
esac
done
#OUTPUT
[root@localhost apcoer]# sh upper.sh
1.Create files :
2.To Upper :
3.To Lower
4.Exit
Enter your choice :
1
Please enter File1 name :
roro
Open and write into roro.txt file manually
1.Create files :
2.To Upper :
3.To Lower
4.Exit
Enter your choice :
2
Upper Case is:
ROHIT MORE
COMPUTER ENGINEERING
1.Create files :
2.To Upper :
3.To Lower
4.Exit
Enter your choice :
3
Lower Case is:
rohit more
computer engineering
1.Create files :
2.To Upper :
3.To Lower
4.Exit
Enter your choice :
4
[root@localhost apcoer]#

No comments:

Post a Comment