如何匹配SED一个单引号 [英] How to match a single quote in sed
本文介绍了如何匹配SED一个单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在SED匹配单引号如果EX pression括在单引号:
SED -e'...'
例如需要将这些内容相匹配:
'富'
解决方案
您可以使用:
texta'textb(APOSTROPHE引号内)
或
'TEXTA'\\''TEXTB'(撇号文本撇号,然后反转SOLIDUS,撇号,然后APOSTROPHE更多的文字撇号)
我用UNI code字符的名称。 REVERSE SOLIDUS更俗称反斜杠。
在后一种情况下,你闭上你的撇号,然后壳报价以反斜线你的撇号,然后打开另一个撇号文的其余部分。
How to match a single quote in sed if the expression is enclosed in single quotes:
sed -e '...'
For example need to match this text:
'foo'
解决方案
You can either use:
"texta'textb" (APOSTROPHE inside QUOTATION MARKs)
or
'texta'\''textb' (APOSTROPHE text APOSTROPHE, then REVERSE SOLIDUS, APOSTROPHE, then APOSTROPHE more text APOSTROPHE)
I used unicode character names. REVERSE SOLIDUS is more commonly known as backslash.
In the latter case, you close your apostrophe, then shell-quote your apostrophe with a backslash, then open another apostrophe for the rest of the text.
这篇关于如何匹配SED一个单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文