Tuesday, 7 January 2014

Count lines, words & characters of a file in Unix

On Unix and Linux machines, if you want to find out the word count, number of lines and the total number of characters used in a certain file, use the wc command in the following way.

Eg:

cat build.xml | wc

The output will be like 

9      26     297

Here, 9 is the number of lines, 26 is the number of words and 297 is the number of characters.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker