Tag Archives: tip

[TIP] Count non-empty lines in a text file

grep -c -v ‘^$’ filename If you want to, as well, exclude lines which contain only spaces: grep -c -v ‘^ *$’ filename Notes (from the grep man page): -c, –count Suppress normal output; instead print a count of matching … Continue reading

Posted in console | Tagged , , | Leave a comment