Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

shell script to count number of lines in a file

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
Source by www.dailyfreecode.com #
 
PREVIOUS NEXT
Tagged: #shell #script #count #number #lines #file
ADD COMMENT
Topic
Name
2+3 =