Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell program to count the characters, count the lines and the words in a particular file

Posted By: Katie Brown     Category: Unix / Linux / Ubuntu     Views: 9634

Write a shell program to count the characters, count the lines and the words in a particular file.

Code for Write a shell program to count the characters, count the lines and the words in a particular file in Unix / Linux / Ubuntu

echo Enter the filename
read file
w=`cat $file | wc -w`
c=`cat $file | wc -c`
l=`grep -c "." $file`
echo Number of characters in $file is $c
echo Number of words in $file is $w
echo Number of lines in $file is $l
  
Share: 



Katie Brown
Katie Brown author of Write a shell program to count the characters, count the lines and the words in a particular file is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!