📜  使用 sed linux bash 替换换行符 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:44.548000             🧑  作者: Mango

代码示例4
# sed is intended to be used on line-based input. Although it can do what you need.
#A better option here is to use the tr command as follows:
tr '\n' ' ' < input_filename

#or remove the newline characters entirely:
tr -d '\n' < input.txt > output.txt

#or if you have the GNU version (with its long options)
tr --delete '\n' < input.txt > output.txt