Answers for "linux command to get number of lines in a file"

5

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
Posted by: Guest on February-12-2021
1

linux command to get number of lines in a file

wc -l <filename>
# output = <number of lines> <filename>
# to omit the file name in output
wc -l < <filename>
# output = <number of lines>
Posted by: Guest on April-15-2021

Code answers related to "linux command to get number of lines in a file"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language