Came across a cool find today that I can implement in Windows to replicate wc -l
. When wanting to count how many lines in a file on Windows, I can use the following.
type test.txt | find /v /c ""
This is saying to count /c
all the lines not containing /v
nothing ""
.
test.txt
a b c d e g
type test.txt | find /v /c "" 8
Note that it counts the empty line between e and g in test.txt. It would also count any extra lines that do not contain data (carriage returns).