Programmer
Programmer

Reputation: 8727

Unix Grep command

I have to search from codebase of lines having following pattern:

"get_token , get_token" 

For example the below line 'type' should be listed:

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

Upvotes: 0

Views: 377

Answers (5)

gyrous
gyrous

Reputation: 209

| grep "get_token.*,.*get_token"

Upvotes: 0

Alok Singhal
Alok Singhal

Reputation: 96241

egrep '(get_token).*\1'

Modify as needed.

Upvotes: 1

Piskvor left the building
Piskvor left the building

Reputation: 92792

grep -E -n 'get_token.*?get_token' *

Upvotes: 0

pakore
pakore

Reputation: 11497

grep -R ".*get_token(),.*get_token()" *

Upvotes: 1

agsamek
agsamek

Reputation: 9074

grep "get_token.*,.*get_token" *

Upvotes: 0

Related Questions