# Applying dot notation against lookup results in one command?

**URL:** <https://forum.ansible.com/t/applying-dot-notation-against-lookup-results-in-one-command/21553>\
**Category:** Ansible Project\
**Created:** [May 24, 2016, 6:26pm UTC](https://forum.ansible.com/t/applying-dot-notation-against-lookup-results-in-one-command/21553 "2016-05-24T18:26:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_S](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Sam\_S](https://forum.ansible.com/u/Sam_S)\
**Post date:** [May 24, 2016, 6:26pm UTC](https://forum.ansible.com/t/applying-dot-notation-against-lookup-results-in-one-command/21553/1 "2016-05-24T18:26:18Z")

</div>

Is there a way to apply dot notation against the ‘environment\_id’ variable so that I do it once and not have to apply it multiple times within my file? What I really want is the value after I “grep” for the last two character in the string (see debug statement).

- name: Get environment idset\_fact:  
environment\_id: “{{ lookup(‘ini’,‘environment section=multidb file=xyz.conf’) }}”

**- debug: msg={{ environment\_id[-2:] }}**

- name: Build list of modules  
set\_fact:  
deploy\_list: “{{ item | replace(‘deploys/’ + environment\_id + ‘/’,‘’) }}-{{ lookup(‘consul\_kv’,‘deploys/’ + environment\_id + ‘/’ + item) }}”  
with\_items: “{{ modules }}”  
register: deploy\_list\_result
