It looks like the number of carriage returns is what is being counted. Also, the command line is concatenated with the last line of text when I do the cat command. So,
cat newdoc
gives me the last line
be savedorangepi@OrangePi:~
where 'be saved' is the last line of the document with the cmd line continuing on the same line and
wc -l newdoc
returns
9 newdoc
orangepi@OrangePi:~
for a 10 line document without the cmd line continuing on the same line.
Be careful with wc
as it will NOT count the very last line unless it has the EOL character at the end. Use grep -c "" filename
instead.