Archive for February 16th, 2009

how do i grep on a term with a $ in it such as $foo? i tried enclosing it in quotes but that doesn’t help

Monday, February 16th, 2009

Enclose the $ in square brackets [ .. ], that is, specify the special character as a character class. For example,

grep ‘[$]foo’ file.txt