Shell script to count characters,words and lines from a file, Programming Languages

W.A.S.S to print the following:

                              i.        Count of characters, words and lines from a file.

                            ii.        Count of five character words.

       iii.     Convert all lower case characters to upper case.

 

Program

 

#W.A.S.S. to Count of characters, words and lines from a file.

 

echo -e "Total character in the file are: \c"

cat good.sh |wc -c

echo -e "Total words in the file are: \c"

cntw=0

 

for w in `cat good.sh`

do

cntw=`expr $cntw + 1`

done

 

echo "$cntw"

echo -e "Total lines in the file are : \c"

cat good.sh |  wc –l

 

Output

 

Total character in the file are:     162

Total words in the file are: 27

Total lines in the file are :      15

Posted Date: 9/26/2012 8:05:39 AM | Location : United States







Related Discussions:- Shell script to count characters,words and lines from a file, Assignment Help, Ask Question on Shell script to count characters,words and lines from a file, Get Answer, Expert's Help, Shell script to count characters,words and lines from a file Discussions

Write discussion on Shell script to count characters,words and lines from a file
Your posts are moderated
Related Questions
In the form of hypermedia documents, Web pages or materials accessed by the Internet can be located anywhere in the world. Regardless of where they originated, most of the Web d


The standard way for debuggers to plant interactive breakpoints in a program in RAM (whatever the processor instruction set) is to save the break pointed instruction and replace it

This case will lead to similar problem that we've had all other time we've run in double roots or double eigenvalues. We only find a single solution and will require a second solut

Write a program to show ten buttons with five possible colors: red, green, orange, yellow, blue. When the user clicks on a button, its color must advance to the next color, or go b

Write a program that takes names of 5 students in 2D Character Array and their GPAs in 1D array. Arrange the names in alphabetical order and display on screen along with GPA.

.NET class libraries in .NET Whether you create value in C# or VB.NET, you are getting in touch with techniques in the same .NET category your local library. The same .NET str

Write a program to read a text file and create a dictionary. The keys for the dictionary should be all 26 letters of the alphabet and the values of the dictionary should be the lis

Calculate the total price based on several key parts required to build a state-of-the-art gaming computer. The user will have the option of selecting different parts.

Of the 6,325 kindergarten students who participated in the study, almost half or 3,052 were eligible for a free lunch program. The categorical variable sesk (1 == free lunch, 2 = n