In all the cases you can use the command wc
wc
Find total number of lines: wc -l filename
wc -l filename
Find total number of words: wc -w filename
wc -w filename
Find total number of characters: wc -m filename
wc -m filename
input: one two three
output: three two one
Words may be separated by any amount of whitespace characters. There can be integers in a file, but the program should only count words which have at least one alphabetic character.
I want to write a c program where I can count no of line, no of blank lines, no of commented lines and no of lines ending with semicolon, please help!!!