Write a linux shell program to perform string manipulation
To perform string manipulation
Code:
clear
echo ---------------------------------------------
echo '\tString Manipulation'
echo ---------------------------------------------
echo Enter the String1
read s1
echo Enter the String2
read s2
s3=$s1$s2
len=$(expr length $s3)
lstring=$(expr $s3 | tr '[:upper:]' '[:lower:]')
ustring=$(expr $s3 | tr '[:lower:]' '[:upper:]')
echo "\nConcatinated String : $s3"
echo String Length : $len
echo String in Lowercase : $lstring
echo String in Uppercase : $ustring
Output:
---------------------------------------------
String Manipulation
---------------------------------------------
Enter the String1
as
Enter the String2
WIN
Concatinated String : asWIN
String Length : 5
String in Lowercase : aswin
String in Uppercase : ASWIN
Leave a Comment