# Working with registered results

**URL:** <https://forum.ansible.com/t/working-with-registered-results/35548>\
**Category:** Ansible Project\
**Created:** [July 26, 2021, 3:03pm UTC](https://forum.ansible.com/t/working-with-registered-results/35548 "2021-07-26T15:03:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 26, 2021, 3:03pm UTC](https://forum.ansible.com/t/working-with-registered-results/35548/1 "2021-07-26T15:03:00Z")

</div>

Hello all, I have a group of switches that users keep asking me to locate mac address for in order to trace down the exact port and edit that port to a new vlan. Rather than logging into each switch and tracking down the switch where the mac resides, I created an ansible a basic ansible playbook to help me with this:

---

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 26, 2021, 8:43pm UTC](https://forum.ansible.com/t/working-with-registered-results/35548/2 "2021-07-26T20:43:42Z")

</div>

I’m getting closer using regex…trying to tweak the regex now (Still any help would be appreciated):

---

<div class="post-metadata">

**Author:** ![Pushparaj\_Gothandam](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/pushparaj_gothandam/32/5538_2.png) [@Pushparaj\_Gothandam](https://forum.ansible.com/u/Pushparaj_Gothandam)\
**Post date:** [July 27, 2021, 1:57am UTC](https://forum.ansible.com/t/working-with-registered-results/35548/3 "2021-07-27T01:57:56Z")

</div>

Use strip() method to get rid of whitespace

debug:  
var: intf[0].strip()

---

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 27, 2021, 3:15am UTC](https://forum.ansible.com/t/working-with-registered-results/35548/4 "2021-07-27T03:15:01Z")

</div>

Thanks Pushparaj, I’ll give that a try & let you know

---

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 27, 2021, 3:24am UTC](https://forum.ansible.com/t/working-with-registered-results/35548/5 "2021-07-27T03:24:20Z")

</div>

That worked! **Thank you very much Pushparaj, you are the man!**

---

<div class="post-metadata">

**Author:** ![chr00ted](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chr00ted/32/2188_2.png) [@chr00ted](https://forum.ansible.com/u/chr00ted)\
**Post date:** [July 27, 2021, 2:12pm UTC](https://forum.ansible.com/t/working-with-registered-results/35548/6 "2021-07-27T14:12:35Z")

</div>

To take it one step further, in the output. I’d like to remove any results that have “UPLINK” in them

I have tried the following below, but “{{ intf\_corrected2 }}” doesn’t show me what I’m expecting.  
I’m expecting to see just the one switch which has the mac and the port isn’t an uplink. Below is where I’m at:
