I have two csv files that give different results when I use wc -l
(gives 65 lines for the first, 66 for the second) and when I use vim file.csv
and then :$
to go to the bottom of the file (66 lines for both). I have tried viewing newline characters in vim
using :set list
and they look identical.
I have created the second (which shows one extra line with wc
) was created from the first using pandas
in Python and to_csv
.
Is there anything within pandas that might generate new lines or other bash/vim tools I can use to verify the differences?
If the last character of the file is not a newline, wc
won't count the last line:
$ printf 'a\nb\nc' | wc -l
2
In fact, that's how wc -l
is documented to work: from man wc
-l, --lines print the newline counts ^^^^^^^^^^^^^