twm answer provides a key pointer, but note that this is a sequence\`
, and not `
by itself, that acts as a start anchor in GNU regular expressions .
Thus, in order to match the literal backward key in the regular expression specified as a single quote string, you do not need escaping at all, either with GNU grep
or with BSD / macOS grep
:
$ { echo 'ab'; echo 'c`d'; } | grep '`'
c`d
, , , - , `
, grep
:
$ { echo 'ab'; echo 'c`d'; } | grep "\`"
c`d
, , "..."
, grep
`
.
GNU grep
:
$ { echo 'ab'; echo 'c`d'; } | grep "\\\`"
ab
c`d
, grep
\`
, GNU grep
, .
- ,
grep
, \`
, ^
; , , , grep -z
- \`
.
BSD/macOS grep
, \`
`
, , .