On 16.10.2018 12:34, Shlomit Afgin wrote:
Hi,
I have
- name: update file1 with 0 in the end if it missing
replace:
backup: yes
dest: /tmp/file1
regexp: '^(start of line.*[^0])$'
replace: '\1 0'
This add 0 to lines that start with "start of line".
It's run okay if there are no empty lines between.
If there is empty line under the match line it add the 0 to the empty
line.
For example, the 2 lines:
start of line fjhdsjkfhdsk
will be:
start of line fjhdsjkfhdsk
0
instead of:
start of line fjhdsjkfhdsk 0
I tried to add the (?<!0) the look behind - but don't work at all.
How can I make it catch the first new line?
It's in the documentation of the module under regexp.
--
Kai Stian Olstad
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/eda784e67bc540eec163d36bb0f5d5c7%40olstad.com.
For more options, visit https://groups.google.com/d/optout.