Skip to content

How to `egrep “mysqli_close” *.php` exclude `*-*.php

To search for files containing “mysqli_close” in all .php files, excluding files with a hyphen in their name (like *-*.php), you can use the find command in combination with grep. Here’s an example command:

find . -type f -name "*.php" ! -name "*-*" -exec grep -E "mysqli_close" {} +

Explanation of the command:

  • find .: Start searching from the current directory.
  • -type f: Look for files only.
  • -name "*.php": Match files with a .php extension.
  • ! -name "*-*": Exclude files containing a hyphen in their name.
  • -exec: Execute a command on the matched files.
  • grep -E "mysqli_close": Use grep with extended regular expressions (-E) to search for “mysqli_close” in the files.
  • {}: Placeholder for the matched file name.
  • +: Indicate the end of the command to be executed on each file.
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *