You've complicated things beyond need:
sed -i '/upload_max_filesize/s/= *10M/=150M/' php.ini
should suffice.
(Passing grep
output from a pager, i.e. less
, input to xargs
doesn't make any sense.)
Question
I am trying to edit a file without making a new one, I need to change a number in a line.
This is what I have so far:
less php.ini | grep "upload_max_filesize"| xargs sed sed -e "s/upload_max_filesize=10M/150M/ > php.ini
but it just sends me to >
The line in the file currently looks like:
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 10M
Solution
You've complicated things beyond need:
sed -i '/upload_max_filesize/s/= *10M/=150M/' php.ini
should suffice.
(Passing grep
output from a pager, i.e. less
, input to xargs
doesn't make any sense.)