When I save lines of data in excel files as tab delimited .txt files, and then open those files in VIM, I see that what was once a multi-line file in excel is now a single line file in VIM.
The “lines” can be separated in VIM using some substitution commands:
%s/^M/\r\n/g
After this, the “lines” are now separated by an ^@.
I deal with it using another substitution command:
%s/^@//g
My questions are:
- Why do my multi-line txt excel files open as a single line in VI?
- What is
^@? - Is there a better way to ‘fix’ my txt files?
Try this command:
\ris the carriage return character vim uses. The^Mcharacter is a newline character that is literally displayed.