开发者

How do I grep for a backtick?

So I'm trying to find backticks (`) in files, so I ran:

grep -irl '\`' ./*
开发者_运维知识库

This seems to return every single file possible...

What else can I try?


My apologies everyone, you have to use -I to ignore binary files. Those were the files that were being returned. I didn't realize this until I removed -l, which indicated to me that the results were binary in nature.

grep -rlI '`' ./*

From the man page:

   -I     Process a binary file as if it did not contain  matching  data;
          this is equivalent to the --binary-files=without-match option.


If you don't actually need to match the backtick itself, but you are looking to match something enclosed by a backtick ( like auto-generated MySQL table names, for instance) a single-character wildcard (".") also does the trick.

I'm using it like this today:

grep "INSERT INTO .my_table." sqldump.sql


just go with, it worked for me

grep -ri \` *


grep -irl '`' *

or

grep -irl \\` *
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜