0

Why does this match

.*\/.+\/wp-admin.*404
[03/Sep/2021:18:58:29 +0200] "GET /up/wp-admin/install.php HTTP/1.1" 404 6197

regexr.com

But in grep it does not?

sudo grep -rh ".*\/.+\/wp-admin.*404" /var/log/apache2/ | wc -l
0

I know the line exists in that folder. If I replace + by * it works.

1 Answer 1

0

With GNU grep, you have to backslash-escape the '+' character. Can you please try this grep -rh ".*\/.\+\/wp-admin.*404" /var/log/apache2/ | wc -l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.