GREP sentance

Does anyone know a way of grepping for a sentence. ie a series of words separated by spaces

Ive tried Grep "this is the sentance" filename without success.

Any ideas what else I could try?

try enclosing your sentence in single quotes, not double.

What version of unix are you using?

grep "this that the other" filename

does work for me. I actually use that a lot. And I just retested it.

Hi,

 I guess that the sentence that you are giving actually must be having more than one space or probably in tab in the file and so you will not get it in the grep command.

However if you do not know how many spaces could be there between the words, may be, you can try the following 

grep "this.*is.*the.*sentance" filename

and i guess that whatever version of unix you use, " or ' quotes will not matter unless your search pattern has any special characters.

rgds
penguin

You can also indicate the spaces by escape characters, like in:

grep This\ is\ my\ sentence *

Capitalization may be an issue for you. Use the -i option so that it is not an issue.

Your command should work on 99% of UNIX systems.

grep "this is a sentence" filename

:cool: