문제

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

도움이 되었습니까?

해결책

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.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top