Grep pattern

I have to search from millions of lines of code of lines having following pattern:

get_token , get_token

For example:

fn1(string.get_token(), string1.get_token());

Thanks in advance

If you have GNU grep or one that allows recursion, you can do

grep -r "get_token.*,.*get_token" source_dir

If you don't have a recursive grep, then this would probably work:

find source_dir -type f -print | 
xargs grep -H "get_token.*,.*get_token"

The -H option can be dropped if not supported.

If you expect many matches, redirect the output with tee:

grep -r "get_token.*,.*get_token" source_dir |
tee matches-get_token.txt

Please post what Operating System and version you are running and your preferred shell.

fgrep would be good for this -- it's faster to search for fixed strings than true regexen if that's all you need.

grep "get_token.*get_token"  urfile
awk '/get_token.*get_token/' urfile

u can use egrep to search multiple patterns