Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 650

Answer by Kamil Maciorowski for How to find file names but only with grep .html OR .php?

$
0
0

There is no need to pipe to grep.

find . -type f -name "*dan*" \( -path '*?html*' -o -path '*?php*' \)

Your grep '.html' would match html preceded with any character (as . in regex matches any character) anywhere in a line, this is why I used -path '*?html*' that does the same thing for pathnames used by find. Maybe this is what you meant, or maybe you really wanted the following:

find . -type f -name "*dan*" \( -name '*.html' -o -name '*.php' \)

where -name '*.html' matches literal.html (the dot is not special) at the end of filename.


Viewing all articles
Browse latest Browse all 650

Trending Articles