I am trying to create a file and it looks like the vi editor is adding a $ at the end of each line. I don't know what's causing this or how to prevent vi from doing it.vi file.txt12345abcdecat -v -e file.txt12345$abcde$wc file.txt2 2 12I don't want those $ symbols at the end; they break my automation files which depend on character count. Why would word count shows 12 characters when in fact each line has 5 characters?VIM version 7.4.629
cat command appears to be adding extra $ character at the end of each line
files;cat;wc
@steeldriver's comment is correct: cat shows line-endings with $ (as vi might if you asked it nicely, using :set list).  The extra character per line is the newline (an invisible character at the end of each line of text).If you want only a count of the printable text, you could filter the file before processing it with wc, e.g., using tr with the -d option.  Here is a script which counts itself as an example:#!/bin/shcat $0 |wccat $0 | tr -d '\r\n\t' | wccat $0 | tr -d '[:cntrl:]' |wcthough the last line is possibly not portable enough for your use (it is in POSIX, in the extended section).   But it will run on anything you're likely to be using, based on the clues in the rationale.