Home > Article > Backend Development > How to remove line terminator in vi/vim editor
<code>vim hello.txt # 输入hello # :wq 保存退出 cat hello.txt</code>
The result is like this:
However:
<code>echo -n "hello" > hello.txt cat hello.txt</code>
The result is like this:
Yes, the cat at this time has a termination mark, and the file will display with no line terminators
But when I edit it with vim and save it, the line terminator appears again.
You can see this newline character using nano, but I don’t know how to use nano and don’t use nano very often (don’t laugh)
--The following content has nothing to do with the topic, it just describes the background of the accident--
This problem caused me to have an extra newline character when using ssi in nginx, so that the style and js address were spliced into newlines, and most browsers could not load normally.
<code><link type="text/css" href="<!--#include virtual='/inc/cdn.inc'-->/public/index.css?v=<!--#include virtual='/inc/version.inc" /></code>
file: cdn.inc, due to manual vim editing of the file, most users of the website were not aware of the style failure (extra line breaks)
<code>mydomain.com</code>
file: version.inc, the script will update this file when it goes online to clear the browser cache
<code>1477452280307</code>
<code>vim hello.txt # 输入hello # :wq 保存退出 cat hello.txt</code>
The result is like this:
However:
<code>echo -n "hello" > hello.txt cat hello.txt</code>
The result is like this:
Yes, the cat at this time has a termination mark, and the file will display with no line terminators
But when I edit it with vim and save it, the line terminator appears again.
You can see this newline character using nano, but I don’t know how to use nano and don’t use nano very often (don’t laugh)
--The following content has nothing to do with the topic, it just describes the background of the accident--
This problem caused me to have an extra newline character when using ssi in nginx, so that the style and js address were spliced into newlines, and most browsers could not load normally.
<code><link type="text/css" href="<!--#include virtual='/inc/cdn.inc'-->/public/index.css?v=<!--#include virtual='/inc/version.inc" /></code>
file: cdn.inc, due to manual vim editing of the file, most users of the website were not aware of the style failure (extra line breaks)
<code>mydomain.com</code>
file: version.inc, the script will update this file when it goes online to clear the browser cache
<code>1477452280307</code>
<code>:set noendofline binary :w</code>
Check if set ff is set to dos
For Linux, the configuration is usually set ff=unix, right?
----- Editor----
I experimented and it seems to have nothing to do with ff-. -