Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Tuesday 13 March 2012

Write a script to display all words of a file in ascending order.


clear
echo "\n\t\t\tAscending order of word in File"
echo "\t\t\t==============================="
echo "\t\t\tEnter File Name "
read filename
echo "\n\n\t\t\t Main File "
echo "\n\t\t\t ========="
echo "\n\t\t\t  "`cat $filename`
 for i in `cat $filename`
 do
echo $i >> tempfile.txt
 done
 `sort tempfile.txt>$filename`
 echo "\n\n\t\t\t Sorted Word in File "
 echo "\n\t\t\t ==================="
 echo "\n\t\t\t  "`cat $filename`
 rm tempfile.txt

No comments:

Post a Comment