sed
is intended to be used on line-based input.
(sed
旨在用于基于行的输入。)
Although it can do what you need. (虽然它可以满足您的需求。)
A better option here is to use the tr
command as follows:
(更好的选择是使用tr
命令,如下所示:)
tr '
' ' ' < input_filename
or remove the newline characters entirely:
(或完全删除换行符:)
tr -d '
' < input.txt > output.txt
or if you have the GNU version (with its long options)
(或您是否拥有GNU版本(及其长选项))
tr --delete '
' < input.txt > output.txt
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…