How to grep the where clause of a SQL?

Hi UNIX Gurus,

I want to use extract the where clause of a SQL present in a file. Please suggest me how can I do it.

Select * from emp where emp_id>10;

cat <file_name> | grep -i "where" returns whole SQL.

how can I extract only "where emp_id>10;"

Thanks in advance

Don't use grep... use sed.

sed -n '/where emp_id>10;/p'

thanks for the suggestion....

the SQL is not fix as the condition mentioned in the where clause may change.....
condition keeps on changing everytime, so we cannot use "where emp_id>10;" in script...

I need to use a logic which will extract the entire where clause.

cat infile
Select * from emp where emp_id>10;

sed 's/.*\(where .*$\)/\1/' infile

wow....
it worked...thanks a lot.....