# Need to parse stdout\_lines output

**URL:** <https://forum.ansible.com/t/need-to-parse-stdout-lines-output/27938>\
**Category:** Ansible Project\
**Created:** [July 2, 2018, 11:32pm UTC](https://forum.ansible.com/t/need-to-parse-stdout-lines-output/27938 "2018-07-02T23:32:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adolphson](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Adolphson](https://forum.ansible.com/u/Adolphson)\
**Post date:** [July 2, 2018, 11:32pm UTC](https://forum.ansible.com/t/need-to-parse-stdout-lines-output/27938/1 "2018-07-02T23:32:54Z")

</div>

I have a stdout\_lines output that I need to grab 2 lines and put into a variable.

Here is the stdout\_lines output:

`

“stdout\_lines”: [  
“WARNING THIS IS A PRIVATE AND PROPRIETARY SYSTEM.”,  
"Password: ",  
“Last login: Mon Jul 2 23:12:56 2018 from 192.168.1.222”,  
“”,  
"[root@localhost:Active:Standalone] config # ls /shared/images/\*.iso |grep -v "12 ",  
“.1.0"|grep -v "13.1.0.7"”,  
**“/shared/images/BIGIP-11.1.0.-0.0.1.iso”,**  
**“/shared/images/Hotfix-BIGIP-11.1.0.0.45.1-ENG.iso”** ,  
“[root@localhost:Active:Standalone] config # exit”,  
“logout”,  
“Connection to 192.168.1.225 closed.”  
]

`

The debug output that I can get so far with this line:

`

- debug: msg=“{{file\_list.stdout\_lines | map(‘regex\_findall’,‘/shared/images/.\*iso$’) | map(‘join’) | list}}”  
“msg”: [  
“”,  
“”,  
“”,  
“”,  
“”,  
“”,  
“/shared/images/BIGIP-11.1.0.-0.0.1.iso”,  
“/shared/images/Hotfix-BIGIP-11.1.0.0.45.1-ENG.iso”,  
“”,  
“”,  
“”  
]

`

Anyone know how I can put these 2 lines into their own variable? I know to use set\_fact but I don’t know how to extract these lines separately.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 3, 2018, 11:40am UTC](https://forum.ansible.com/t/need-to-parse-stdout-lines-output/27938/2 "2018-07-03T11:40:00Z")

</div>

You could try:

- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myvar: '{{ file\_list.stdout\_lines | map("regex\_search", "/shared/images/.\*iso$") | select("string") | list }}'
