Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Grep Help

Re: Grep Help

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Thu, 13 Apr 2006 10:44:58 +0200
Message-ID: <008b01c65ed6$8cd2df00$1a03310a@MPILA9>


>> 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-l
Received on Thu Apr 13 2006 - 03:44:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US