Reputation: 2192
I have for example this line in my file (note that the numbers after = are every time different):
abcd=1234
and I need to change it to:
abcd=9999
How can I do it?
Upvotes: 0
Views: 4333
Reputation: 4388
Try sed -i.backup -e 's/abcd=.*/abcd=9999/' filename.txt
Example in filename.txt
abcd=123
abcd=15652
Output as expected:
abcd=9999
abcd=9999
Note: It has been presented to me that this is the GNU sed, which has some extensions apparently that make it different from the normal sed. I was not aware of this, and I have no means to verify this. If someone has the non-gnu solution, please feel free to edit it in.
Upvotes: 2