What kind of file is this? It looks like yaml? On Mon, 19 Jun 2023 at 18:47, Veera <[email protected]> wrote:
> 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)* > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/2f54435b-b00c-48b5-b349-53f2953c5725n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/2f54435b-b00c-48b5-b349-53f2953c5725n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Sent from Gmail Mobile -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLbPajg-fNs1sc-kW9EtQENxOxsrZQM3hZdmrRu7GgkkEA%40mail.gmail.com.
