Re: Grep Help
- From: "Radoulov, Dimitre" <cichomitiko@xxxxxxxxx>
- To: <post.ethan@xxxxxxxxx>
- Date: Thu, 13 Apr 2006 10:44:58 +0200
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
--
//www.freelists.org/webpage/oracle-l
Other related posts: