When grep “\\” XXFile I got “Trailing Backslash”

后端 未结 2 1920
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-31 01:25

Now I want to find whether there are lines containing \'\\\' character. I tried grep \"\\\\\" XXFile but it hints \"Trailing Backslash\". But when I tried gre

2条回答
  •  不要未来只要你来
    2021-01-31 02:12

    You could have written the command as

    grep "\\\\" ...
    

    This has two pairs of backslashes which bash will convert to two single backslashes. This new pair will then be passed to grep as an escaped backslash getting you what you want.

提交回复
热议问题