I have a .txt file that has 10781 lines in it. When I run wc -l on the file I get a return of 10780.If I add a blank line at the end of the .txt I get the correct result of 10781. Can someone explain what exactly wc -l counts?
wc -l not returning correct value
wc
Probably your last line does not have a newline.See this:$ printf bla > file$ wc -l file0 file$ man 1p wc-l     Write to the standard output the number of newlines in each input file.On Unix it's good style to have a newline character at the end of text files. If you can't repair your files you can use these workarounds to count the last line always:https://stackoverflow.com/questions/28038633/wc-l-is-not-counting-last-of-the-file-if-it-does-not-have-end-of-line-character