美文网首页Shell
sed去除文本中的双引号

sed去除文本中的双引号

作者: 苏牧传媒 | 来源:发表于2018-09-14 12:25 被阅读5次

more aa.txt

"hello"

cat aa.txt |sed 's/\"//g'  

结果是:hello

解析:

s 为替换

以g结尾表示的是:全局性,意即”替代文本取代正则表达式中每一个匹配的”

直接改变的话用i:

sed i 's/\"//g'  aa.txt

另外输出的话:

sed 's/\"//g'  aa.txt > aa.clean.txt

相关文章

网友评论

    本文标题:sed去除文本中的双引号

    本文链接:https://www.haomeiwen.com/subject/bncogftx.html