sed命令删除换行符
时间: 2023-09-11 18:03:32 浏览: 152
要使用sed命令删除换行符,可以使用以下命令:
echo -e "hello\nworld" | sed ':label;N;s/\n//g;b label'
这个命令会将"hello"和"world"之间的换行符删除掉,输出结果为"helloworld"。这个命令使用了sed的替换命令s/\n//g,将换行符替换为空字符串。同时,使用了标签和跳转指令来实现循环处理,确保所有的换行符都被替换掉。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [sed 去掉所有的换行符](https://blog.csdn.net/zgljl2012/article/details/106252323)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [sed 删除换行符](https://blog.csdn.net/banghuan8748/article/details/101532683)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文