# How to delete multiple lines after a match?

**URL:** <https://forum.ansible.com/t/how-to-delete-multiple-lines-after-a-match/20692>\
**Category:** Ansible Project\
**Created:** [February 26, 2016, 8:31pm UTC](https://forum.ansible.com/t/how-to-delete-multiple-lines-after-a-match/20692 "2016-02-26T20:31:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weiwen\_Chen](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@Weiwen\_Chen](https://forum.ansible.com/u/Weiwen_Chen)\
**Post date:** [February 26, 2016, 8:31pm UTC](https://forum.ansible.com/t/how-to-delete-multiple-lines-after-a-match/20692/1 "2016-02-26T20:31:37Z")

</div>

Hello Expert,

Is there a way in ansible to delete multiple lines after a pattern matched?

For example, I have a file with following contents, and need to delete lines ‘bbbbbb’, ‘cccccc’. However I really do not know what are those two lines as they are generated dynamically. I only know line ‘aaaa:’

---

<div class="post-metadata">

**Author:** ![Weiwen\_Chen](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@Weiwen\_Chen](https://forum.ansible.com/u/Weiwen_Chen)\
**Post date:** [March 2, 2016, 5:11pm UTC](https://forum.ansible.com/t/how-to-delete-multiple-lines-after-a-match/20692/2 "2016-03-02T17:11:01Z")

</div>

I end up with replace module with pattern ‘aaaa:’ in it.
