how to skip a line in a file

14 views
Skip to first unread message

ryad9...@gmail.com

unread,
Feb 26, 2019, 5:53:05 AM2/26/19
to Ansible Project
Hy all,

I have a file called "file1.csv", the contents of this file is:

word1  word2  word3  word4

I want him to jump in line with every word, i want this result :

word1
word2
word3
word4

I use this task for test but she replace every space by \n :

{{ lookup('file' , '/home/my_user/file1.csv') | replace(' ' , '\n')  }}

Someone have an idea please ??!!

Thank you very much guy !! :)

Jean-Yves LENHOF

unread,
Feb 26, 2019, 6:00:41 AM2/26/19
to ansible...@googlegroups.com, ryad9...@gmail.com
Use regex_replace instead of replace with the good regex (you need to
use python regex)

Regards,

JYL

ryad9...@gmail.com

unread,
Feb 26, 2019, 7:03:56 AM2/26/19
to Ansible Project
Thank you very much, regex_replace works perfect !! 

You are very strong Jean-Yves !! :)

regards
Reply all
Reply to author
Forward
0 new messages