Ubuntu – Using grep to search texts with single quote

command linegeditgrep

I am using gedit text editor with embedded terminal in ubuntu 12.04. I'm trying to search for some text using grep. I want to search for this line of code

'type' => 'select'

I tried:

grep -r '\'type\' => \'select\''

But grep didn't return any results.

So can someone kindly tell me how to search for the code above?

Best Answer

Surround your search string with double quotes:

grep "'type' => 'select'"
Related Question