Reputation: 233
Say I have a file called file.txt that contains
abc
post_max_size = 100M
def
I need a script that will find the line containing post_max_size and replace the entire line with post_max_size = 50M. So it will result as:
abc
post_max_size = 50M
def
Thanks
Upvotes: 0
Views: 1488
Reputation: 86974
[me@home]$ cat file.txt
abc
post_max_size = 100M
def
[me@home]$ sed -i 's/.*post_max_size.*/post_max_size = 50M/' file.txt
[me@home]$ cat file.txt
abc
post_max_size = 50M
def
Upvotes: 2