I want to know which files have the string
grep \$Id\$ my_dir/mylist_of_files
returns 0 occurrences.
I discovered that I have to use
grep \$Id$ my_dir/mylist_of_files
Then I see that the
$Id is colored in the output, i.e. it has been matched.
How could I match the second
$ and why doesn't
It doesn't matter if the second
$ is the last character or not.
Before posting my question, I used google...
To search for a $ (dollar sign) in the file named test2, enter:
grep \\$ test2
The \\ (double backslash) characters are necessary in order to force the shell to pass a \$ (single backslash, dollar sign) to the grep command. The \ (single backslash) character tells the grep command to treat the following character (in this example the $) as a literal character rather than an expression character. Use the fgrep command to avoid the necessity of using escape characters such as the backslash.
but I don't understand why
grep \$Id works and why
grep \\$Id\\$ doesn't.
I'm a little bit confused...