I'm trying grep 7 lines after match and replace a context in those 7 lines and save it in the same file.
For Example:
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
i would like to replace the value of MaxRequestsPerChild
with 5000
.
I have tried with:
grep "IfModule prefork.c" httpd.conf -A7 | /bin/sed -nE "/\bMaxRequestsPerChild\b/ s/[0-9]+/50/"
But no luck.