How to grep asterisk without escaping?

后端 未结 2 1192
旧时难觅i
旧时难觅i 2021-01-02 18:42

Suppose I have a file abc.txt which contains line ab*cd. When I grep that pattern ab*cd with quotes but without escaping

2条回答
  •  星月不相逢
    2021-01-02 19:02

    first of all, you should keep in mind: regex =/= glob

    * has special meaning in regex. You have to escape it to match it literally. without escaping the *, grep tries to match ab+(any number of b)+c

    for example:

    abbbbbbbbbbbbc

提交回复
热议问题