Mike Nguyen
Mike Nguyen

Reputation: 1053

grep file with full contain string

I have some pattent and I really stuck to deal with it:

$order_item->meta->pickingDate = $pickingDate;
$order->meta->{'-update'} = array('status');

I run grep command ti list file match: grep -r -l "->meta->"

But my expect: grep ????

*- Red color with: "->meta->pickingDate" and "meta->{'-update'}"

I mean it match with "->meta->" and get the next string they have. How can I deal with this case ? what I have to put to grep to match with my expect ?

Thanks all.

Upvotes: 0

Views: 76

Answers (1)

Avinash Raj
Avinash Raj

Reputation: 174874

You could try this,

grep -r -l "->meta->[^[:space:]]*" file

OR

grep -r "\b->meta->[^[:space:]]*" file

OR

grep -r -l "\b->meta->[^[:space:]]*" file

[^[:space:]]* POSIX class which matches any character but not of a space zero or more times.

Upvotes: 4

Related Questions