remove square bracket regexp in ansible playbook

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

remove square bracket regexp in ansible playbook

sakshira...@gmail.com
hi all,

i am new to ansible and need some advise.
i am merging 2 lists from 2 different files and i am getting result which is seperated by square bracket. 

how i can remove square bracket from the file using regexp in ansible playbook. 

please advise. i am using lineinfile module for regep:

name: Remove extra characters 
  lineinfile :
    path: "../ip_address.txt"
    state: absent
    regexp: '^$' 
    #regexp: '^([ ]+)[^\n]+$'
    #replace: '\g<1>0.0.0.0'
    #shell: | 
    # cat ../ip_address.txt | sed 's/[][]//g'
    #regexp: ('^(.*[\\=/])')

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bed41757-351b-4cf4-a82e-4aa9c8a7fb68n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: remove square bracket regexp in ansible playbook

Amedee Van Gasse
You're probably mistaken in your mailing lists, this is the Jenkins mailing list.
I thing you should ask over at https://groups.google.com/g/ansible-project ([hidden email])

On Monday, February 22, 2021 at 10:31:38 AM UTC+1 [hidden email] wrote:
hi all,

i am new to ansible and need some advise.
i am merging 2 lists from 2 different files and i am getting result which is seperated by square bracket. 

how i can remove square bracket from the file using regexp in ansible playbook. 

please advise. i am using lineinfile module for regep:

name: Remove extra characters 
  lineinfile :
    path: "../ip_address.txt"
    state: absent
    regexp: '^$' 
    #regexp: '^([ ]+)[^\n]+$'
    #replace: '\g<1>0.0.0.0'
    #shell: | 
    # cat ../ip_address.txt | sed 's/[][]//g'
    #regexp: ('^(.*[\\=/])')

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/51175a9e-9df6-42e0-8461-f7eb9a01a13cn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: remove square bracket regexp in ansible playbook

sakshira...@gmail.com
Yes indeed, thanks!

On Tue, 23 Feb, 2021, 12:07 PM Amedee Van Gasse, <[hidden email]> wrote:
You're probably mistaken in your mailing lists, this is the Jenkins mailing list.
On Monday, February 22, 2021 at 10:31:38 AM UTC+1 [hidden email] wrote:
hi all,

i am new to ansible and need some advise.
i am merging 2 lists from 2 different files and i am getting result which is seperated by square bracket. 

how i can remove square bracket from the file using regexp in ansible playbook. 

please advise. i am using lineinfile module for regep:

name: Remove extra characters 
  lineinfile :
    path: "../ip_address.txt"
    state: absent
    regexp: '^$' 
    #regexp: '^([ ]+)[^\n]+$'
    #replace: '\g<1>0.0.0.0'
    #shell: | 
    # cat ../ip_address.txt | sed 's/[][]//g'
    #regexp: ('^(.*[\\=/])')

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/51175a9e-9df6-42e0-8461-f7eb9a01a13cn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJeB3MMkL9OytdcYfvq8ZyCFUM4x8wOgVX%2BmfmGUqGnP_50nkg%40mail.gmail.com.