I need to uncomment and edit this line using sed
:
root@host:~# cat $CONF | grep "pm\.max_requests"
;pm.max_requests = 500
Tried this, but nothing worked:
root@host:~# sed -i "s/^;?pm\.max_requests *= *[^ ]*/pm.max_requests = 512/" ${CONF}
root@host:~# sed -i "s/^\;?pm\.max_requests *= *[^ ]*/pm.max_requests = 512/" ${CONF}
root@host:~# sed -i "s/^(;)?pm\.max_requests *= *[^ ]*/pm.max_requests = 512/" ${CONF}
root@host:~# sed -i "s/^(;?)pm\.max_requests *= *[^ ]*/pm.max_requests = 512/" ${CONF}
Here's what did work:
root@host:~# sed -i "s/^;pm\.max_requests *= *[^ ]*/pm.max_requests = 512/" ${CONF}
Problem is, the command has to work even if a semicolon isn't there.
I know I can start with something like below, but I was hoping I can have it done all in one line.
sed -i "s/#;pm\.max_requests/pm.max_requests/g" ${CONF}
Checked if this is a duplicate, but all I could find was Removed semicolon from a line in php.ini using shell command