在 2016年01月07日 20:21, Burton, Ross 写道:

On 7 January 2016 at 03:29, Yi Zhao <yi.zhao@windriver.com> wrote:
Sometimes the grep output is not correct if the log message contains
some special characters. Use re.escape to escape all non-alphanumerics
before grep

If we're going to insist that the strings are literal then instead of telling grep to use extended regexp's and passing escaped regexs, why not just use -F which tells grep to search for fixed strings, not expressions.
Hi Ross,

It still need to escape quotation marks if using -F option.
Consider the following log:
[521514.737] (EE) evdev: Qemu Tablet: Unable to open evdev device "/dev/input/touchscreen0".

We still need an extra step to replace " with \" before grep

Yi
 

Ross