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: Adelfrid Fischer     Category: Unix / Linux / Ubuntu     Views: 8921

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: 



Adelfrid Fischer
Adelfrid Fischer author of Write a shell program to count the characters, count the lines and the words in a particular file is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
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!