remove square bracket regexp in ansible playbook

201 views
Skip to first unread message

sakshira...@gmail.com

unread,
Feb 22, 2021, 4:31:38 AM2/22/21
to Jenkins Users
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: ('^(.*[\\=/])')

Amedee Van Gasse

unread,
Feb 23, 2021, 6:07:24 AM2/23/21
to Jenkins Users
You're probably mistaken in your mailing lists, this is the Jenkins mailing list.

Sakshi Rathore

unread,
Feb 23, 2021, 6:13:51 AM2/23/21
to jenkins...@googlegroups.com
Yes indeed, thanks!

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/51175a9e-9df6-42e0-8461-f7eb9a01a13cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages