# How to extract specific value from register output

**URL:** <https://forum.ansible.com/t/how-to-extract-specific-value-from-register-output/34740>\
**Category:** Ansible Project\
**Created:** [March 8, 2021, 3:57pm UTC](https://forum.ansible.com/t/how-to-extract-specific-value-from-register-output/34740 "2021-03-08T15:57:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudu.c](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dudu.c](https://forum.ansible.com/u/dudu.c)\
**Post date:** [March 8, 2021, 3:57pm UTC](https://forum.ansible.com/t/how-to-extract-specific-value-from-register-output/34740/1 "2021-03-08T15:57:42Z")

</div>

How to extract a specific value from register output:

From the below register output I’m trying to extract the **path** value with no luck, I have tried few options but still, I’m falling

- debug:  
msg: “{{ file\_name }}” - debug:  
msg: “{{ file\_name.results.path }}” - debug:  
msg: “{{ file\_name.path }}”

File\_name register output

“msg”: {

“changed”: false,

“msg”: “All items completed”,

“results”: [

{

“ansible\_loop\_var”: “item”,

“changed”: false,

“checksum”: “45823e35872e278fe781a182aa50abcd92d2df62”,

“dest”: “/data/nifi-deployment/file\_32.tar.gz”,

“diff”: {

“after”: {

“path”: “/data/nifi-deployment/file\_32.tar.gz”

},

“before”: {

“path”: “/data/nifi-deployment/file\_32.tar.gz”

}

},

“failed”: false,

“gid”: 0,

“group”: “root”,

“invocation”: {

“module\_args”: {

“\_diff\_peek”: null,

“\_original\_basename”: " file\_32.tar.gz ",

“access\_time”: null,

“access\_time\_format”: “%Y%m%d%H%M.%S”,

“attributes”: null,

“backup”: null,

“content”: null,

“delimiter”: null,

“dest”: “/data/nifi-deployment”,

“directory\_mode”: null,

“follow”: true,

“force”: true,

“group”: null,

“mode”: null,

“modification\_time”: null,

“modification\_time\_format”: “%Y%m%d%H%M.%S”,

“owner”: null,

“path”: “/data/nifi-deployment/file\_32.tar.gz”,

“recurse”: false,

“regexp”: null,

“remote\_src”: null,

“selevel”: null,

“serole”: null,

“setype”: null,

“seuser”: null,

“src”: null,

“state”: “file”,

“unsafe\_writes”: null

}

},

“item”: "/repo/file\_32.tar.gz ",

“mode”: “0644”,

“owner”: “root”,

**“path”: “/data/nifi-deployment/file\_32.tar.gz”,**

“secontext”: “system\_u:object\_r:default\_t:s0”,

“size”: 4938,

“state”: “file”,

“uid”: 0

}

]

}

}

---

<div class="post-metadata">

**Author:** ![Nuno\_Jordao](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@Nuno\_Jordao](https://forum.ansible.com/u/Nuno_Jordao)\
**Post date:** [March 8, 2021, 4:21pm UTC](https://forum.ansible.com/t/how-to-extract-specific-value-from-register-output/34740/2 "2021-03-08T16:21:45Z")

</div>

Hello,

It’s inside a “results” list. The result of a loop?  
In that case you need: {{ file\_name.results[0].path }} to get the first element of the “results” list.  
If you have more, you need a loop to iterate it.

Nuno Jordão
