Linux grep command

Sometimes, we need grep a string with slash/ or backslash\, like we want to know where we called this model “use App\Models\Users” in the code.

First, I tried grep -rils “Models\\Users”, nothing returned;

Then I tried grep -rils “Models/\Users”, still nothing returned;

Very occasionally, I tried grep -rils “Models\\\Users”, it returned results as I expected.

Advertisements

About qianggan

Sr. Software Engineer
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s