10

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?

bafromca
  • 1,926
  • 4
  • 27
  • 42

4 Answers4

7

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.
bafromca
  • 1,926
  • 4
  • 27
  • 42
5

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
Bhavin Solanki
  • 1,364
  • 11
  • 27
Tyler Hains
  • 65
  • 1
  • 2
1

just go with, it worked for me

grep -ri \` *
marcelog
  • 7,062
  • 1
  • 33
  • 46
1
grep -irl '`' *

or

grep -irl \\` *
Tomas
  • 57,621
  • 49
  • 238
  • 373