Wednesday, June 15, 2011

Number of lines in a file

Counting the number of lines in given file is generally useful, especially in conjunction with grep.

grep "abc" * -r | wc -l 
wc -l myfile
Word count also has the ability to count the number of words or characters in a file using the -w and -m options respectively.