grep count lines

C++
cat myfile | wc -lwc -l myfile
cat -n myfile
 grep -c ^ filename
cat myfile | wc -l

Source

Also in C++: