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.

anx
  • 8,963
  • 5
  • 24
  • 48

1 Answers1

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

oogway
  • 64
  • 2