Hi,
I am trying to replace a line/string in a 224 lines file .
Trying with replace and lineinfile module , but seems i am missing a bit..
below is the string to consider:
logging.files:
# Configure the path where the logs are written. The default is the logs directory
# under the home path (the binary location).
path: /var/log/original
.
Here I want to replace the " /var/log/original" to " /var/log/newfile" and I have to search based on the string "logging.files:" which is 3 lines above.
- name: Configuring the inputs for the file
replace:
path: /etc/myagent/myfile
after: 'logging.files:' here i want to search 4th line below the match.. similar to grep -A3)
regexp: '
path: /var/log/original '
replace: "
path: /var/log/newfile "
I have multiple lines with similar entries and I cannot replace directly (based on first match too)