# line break with lookup

**URL:** <https://forum.ansible.com/t/line-break-with-lookup/30682>\
**Category:** Ansible Project\
**Created:** [June 28, 2019, 8:24am UTC](https://forum.ansible.com/t/line-break-with-lookup/30682 "2019-06-28T08:24:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karther](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@Karther](https://forum.ansible.com/u/Karther)\
**Post date:** [June 28, 2019, 8:24am UTC](https://forum.ansible.com/t/line-break-with-lookup/30682/1 "2019-06-28T08:24:17Z")

</div>

Hy all,

I have one file my\_file with this content :

myfirstparaphrase

I have this task :

- set\_fact:  
variable1: “{{ lookup(‘file’, ‘/home/ansible/my\_file’) | replace(’ ', ‘\n’) }}”

I want that in the end of my phrase, there is line breack but this task not works …

Someone have idea please community ansible ??! 🙂

Thanks,

Regards,

---

<div class="post-metadata">

**Author:** ![Punit\_Jain](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Punit\_Jain](https://forum.ansible.com/u/Punit_Jain)\
**Post date:** [June 28, 2019, 12:39pm UTC](https://forum.ansible.com/t/line-break-with-lookup/30682/2 "2019-06-28T12:39:20Z")

</div>

Are you looking for this . ?

set\_fact:  
variable1: “{{lookup(‘file’, ‘my\_file’) if ‘\n’ in lookup(‘file’, ‘my\_file’) else lookup(‘file’, ‘my\_file’) + ‘\n’}}”

---

<div class="post-metadata">

**Author:** ![Karther](https://avatars.discourse-cdn.com/v4/letter/k/3ec8ea/32.png) [@Karther](https://forum.ansible.com/u/Karther)\
**Post date:** [June 28, 2019, 1:32pm UTC](https://forum.ansible.com/t/line-break-with-lookup/30682/3 "2019-06-28T13:32:49Z")

</div>

Hy,

I have try this issue, but +‘\n’ is write at the end of my file and he not play role of “line break” …  
I don’t know if do you understand ?? 🙂

Thanks for your answer 😉

Regards,
