sed 帮助:匹配和替换文字“ "(不是换行符) [英] sed help: matching and replacing a literal " " (not the newline)
本文介绍了sed 帮助:匹配和替换文字“
"(不是换行符)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含多个 实例的文件.
i have a file which contains several instances of .
我想用实际的换行符替换它们,但 sed 无法识别 .
i would like to replace them with actual newlines, but sed doesn't recognize the .
我试过了
sed -r -e 's/
/
/'
sed -r -e 's/\n/
/'
sed -r -e 's/[
]/
/'
以及许多其他逃避它的方法.
and many other ways of escaping it.
sed 能够识别文字 吗?如果是这样,如何?
is sed able to recognize a literal ? if so, how?
是否有另一个程序可以读取将 解释为真正的换行符的文件?
is there another program that can read the file interpreting the 's as real newlines?
推荐答案
你能试试这个吗
sed -i 's/\n/
/g' input_filename
这篇关于sed 帮助:匹配和替换文字“ "(不是换行符)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文