Wednesday, June 22, 2005

Counting lines with grep

Interesting option called -c , which lets you suppress output and oonly print the count of lines that matched so here is a replacement for "wc -l".

%cat bajajautofinance |grep -c ^.*$
11
%cat bajajautofinance |wc -l
11


0 Comments:

Post a Comment

<< Home