简体   繁体   English

Grep 特殊字符#'

[英]Grep special character #‘

trying to grep "#'om" but not able to escape or account for the quote char.试图 grep "#'om"但无法逃脱或解释报价字符。 I tried grep -F , grep -e , grep -n or simply grep "#\'om" to no avail.我试过grep -Fgrep -egrep -n或干脆grep "#\'om"没有。

That quote is not the simple quote character it appears to be.该引号不是它看起来的简单引号字符。 It's not clear whether copying-and-pasting the quote character from this website is accurate.目前尚不清楚从本网站复制和粘贴引号字符是否准确。

$ echo '‘' | cat -v
M-bM-^@M-^X

$ echo '‘' | xxd
$ 00000000: e280 980a                                ....

So, it appears the problem is one of character sets.因此,问题似乎是字符集之一。

Note, however, that the following works for me:但是请注意,以下内容对我有用:

$ echo '‘' | grep -F '‘'
‘

As does the following:如下所示:

$ echo '#‘om' | grep -F '#‘om'
#‘om

It would help to see exactly what is being tried.这将有助于确切了解正在尝试的内容。 Perhaps use xxd to confirm what bytes are making up that quote.也许使用xxd来确认哪些字节构成了该报价。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM