# Remove multiple lines from a file

**URL:** <https://forum.ansible.com/t/remove-multiple-lines-from-a-file/24206>\
**Category:** Ansible Project\
**Created:** [April 12, 2017, 5:31pm UTC](https://forum.ansible.com/t/remove-multiple-lines-from-a-file/24206 "2017-04-12T17:31:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BPradhan](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@BPradhan](https://forum.ansible.com/u/BPradhan)\
**Post date:** [April 12, 2017, 5:31pm UTC](https://forum.ansible.com/t/remove-multiple-lines-from-a-file/24206/1 "2017-04-12T17:31:28Z")

</div>

Hi All

I am trying to remove multiple lines from a file. But not successful yet.

The file contents are:

SID\_LIST\_LISTENER=

(SID\_LIST=  
(SID\_DESC=  
(GLOBAL\_DBNAME=RS5\_DBADATATEST2)  
(ORACLE\_HOME=/orahome/app/oracle/product/11.2.0/dbhome\_1)  
(SID\_NAME=RS5)  
)  
(SID\_DESC=  
(GLOBAL\_DBNAME=SUMMER\_DBADATATEST2)  
(ORACLE\_HOME=/orahome/app/oracle/product/11.2.0/dbhome\_1)  
(SID\_NAME=SUMMER)  
)  
)

and I am trying to remove the following lines only:

(SID\_DESC=  
(GLOBAL\_DBNAME=RS5\_DBADATATEST2)  
(ORACLE\_HOME=/orahome/app/oracle/product/11.2.0/dbhome\_1)  
(SID\_NAME=RS5)  
)

1] I tried with blockinfile (with state=absent), but does not work. Not sure what should be the “markers”

2] lineinfile also does not work for me with the ones I tried.

Any pointer would help.

Regards  
Bhabani
