Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Grep Help
>> cat f
>
>$Log: Blah
>
>> grep "\$Log: .*\$" f
>
>$Log: Blah
>
>I am actually looking for a line which has Dollar Log Colon ...any
>characters...dollar...any characters...but this still returns the line,
>even
>thought it is missing the last dollar.
To search for a dollar sigh ($) with grep (when you use double quotes) you
have to use \\ (double backslash).
It's 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.
So you can use:
grep "\$Log:.*\\$" f
or single quotes (they protect your regular expression from the shell):
grep '$Log:.*\$' f
Regards,
Dimitre
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Apr 13 2006 - 03:44:58 CDT