clear echo "Enter File Name :=" read filename echo "1. Number Of Character" echo "2. Number Of Words" echo "3. Number Of Lines" echo "4. File In Reverse" echo "5. Fequency Of Particular Word" echo "6. Convert Upper Case to Lower Case" echo "Enter Your Choice :=" read ch case $ch in 1) echo "Total Number Of Characters are : " `cat $filename |wc -c` ;; 2) echo "Total Number Of Words are : " `cat $filename |wc -w` ;; 3) echo "Total Number Of Lines are : " `cat $filename |wc -l` ;; 4) revstr="" while read -n1 ch; do revstr="$ch$revstr" done<$filename echo "File In Reverse Order : " echo $revstr ;; 5) clear echo "Enter Word To Search : " read search filename="veer.txt" str=`grep -i "$search" $filename` `echo $str | tr '[A-Z]' '[a-z]'>file.txt` i=1 count=0 len=`echo $str | wc -c` echo "length is $len" search=`echo $search|tr '[A-Z]' '[a-z]'` echo "SEARCH WORD:$search" i=1 while read -n1 ch; do if [ "$ch" == " " ] || [ $i -eq $len ];then if [ "$word" == "$search" ];then count=`expr $count + 1` fi word="" else word="$word$ch" fi i=`expr $i + 1` doneOutput:file.txt` `cat file.txt > $filename` echo "ALL CHARACTER CONVERTED TO LOWER CASE" ;; *) echo "Enter poper Values " esac
0 comments:
Post a Comment