Bug #6431
closedHow to line replacement in Enforce a file content
Description
Situation:
In file /etc/myservice.config on server1:
mail.recipients=jon@mydom.com,doe@mydom.com,user1@mydom.com
In file /etc/myservice.config on server2:
#mail.recipients=mailer@mydom.com
I want to change these parameters to mail.recipients=ops@mydom.com
My Regex: [#]?(mail.recipients=).*
My String remplacement: mail.recipients=ops@mydom.com
But it doesn't work
Please provide docmentation on how to do this
Updated by Nicolas CHARLES over 9 years ago
- Status changed from New to Discussion
- Assignee set to Anthony Lawson
Hi Anthony,
To replace a line with Enforce a file content (or with any other technique/generic method that would do replacement), you need that the regexp doesn't match the string you are putting.
So, the regexp you'll need probably is
[#]?mail.recipients=(?!ops@mydom.com$).*
Updated by Anthony Lawson over 9 years ago
Hi Nicolas,
Thanks, it works fine for me
Updated by Dennis Cabooter over 9 years ago
Hi Nicolas,
Maybe it would be a good idea to add an example like this in the documentation. I needed it once as well and fortunatly you were helping me to get it right. To be honest I'm able to do some basic regex, but I'm not a regex guru. :D
Updated by Nicolas CHARLES over 9 years ago
- Category set to Techniques
- Status changed from Discussion to 8
- Assignee changed from Anthony Lawson to Nicolas CHARLES
- Target version set to 2.10.13
Updated by Nicolas CHARLES over 9 years ago
- Related to deleted (Bug #5979: Document usage of line replacement in Enforce a file content technique)
Updated by Nicolas CHARLES over 9 years ago
- Is duplicate of Bug #5979: Document usage of line replacement in Enforce a file content technique added
Updated by Nicolas CHARLES over 9 years ago
- Status changed from 8 to Rejected
Rejecting as a duplicate of 5979; it is fixed there