tofutim
tofutim

Reputation: 23374

Looking for a trailing $ sign using Regex

The pattern I'm looking for looks like $guid1$ with the $ signs on each side. Unfortunately, my regex in grep (and probably elsewhere) interprets that last $ as something else.

"\$guid[0-9]\$" works but "\$guid[0-9]\$" does not. What can I do?

Upvotes: 1

Views: 34

Answers (1)

anubhava
anubhava

Reputation: 785176

You need to use single quotes around your regex:

grep '\$guid1\$' file

OR use fgrep for fixed string search:

fgrep '$guid1$' file

Upvotes: 1

Related Questions