'Replace a value of parameter in a file

I have a multiple files named paramaters.txt containing different parameters and their values:

param1 = vaue1
param2 = value2
param3 = value3

And I'd like to replace value of param2 and have

param1 = vaue1
param2 = value4
param3 = value3

I was trying to use sed but I was able to do it if I know the string I want to replace, value2 in my case. But I don't know it (or rather it can be different in different files). I would rather try to find string param2 and replace everything that is on the right side of it. But I don't know how to do it.

Any hint will be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source