SED - Count - Count lines in a file

Emulates “wc -l”.

sed -n '$=' filename

Example

Running that command again this file:

testfile
aaa
bbb
ccc

returns:

3