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"
: Usegrep
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.
Be First to Comment