The wc command is used unix to get the word command,number of lines , character count etc. syntax : > wc [options] The following are the option of a wc command Options Description -c print the byte count in input -m print the character count in input -l print the newline count in input -L print the length of the longest line in input -w print the word count i n input For example consider the input file sample.txt >cat sample.txt apple orange mango kiwi Cherry Now lets look at the output if you give a wc command on it. 1. wc command > wc sample.txt 5 5 31 sample.txt The output is printed like number of lines, words, and bytes in the file. 2. wc command to find number of line in a file - this will count for number of \n characters in the file and give that as output. > wc -l sample.txt 5 sample.txt 3.
A technology and programming blog to share knowledge and solutions to problems came across