我正在寻找其中有撇号的线条,并尝试了一些看起来与我完全相同的表达方式;然而,有些人工作,其他人没有。为什么我会得到以下行为:这些正则表达式为什么不同?
egrep \' file # works as expected
egrep "\'" file # seems to return all lines
egrep "[\']" file # works as expected
egrep '\'' file # seems to be waiting for more input
您的措辞有点误导:_escaping with quotes_ sounds like you're _using_ quotes escape。好的建议重新:使用'回声'来理清发生了什么 – pb2q 2012-07-28 07:21:09
你会如何逃避单引号中的字符? – bqui56 2012-07-28 07:25:01