# Anyway to get output without all the "!"?

**URL:** <https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102>\
**Category:** Ansible Project\
**Created:** [August 22, 2019, 3:49pm UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102 "2019-08-22T15:49:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Williams](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Steven\_Williams](https://forum.ansible.com/u/Steven_Williams)\
**Post date:** [August 22, 2019, 3:49pm UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/1 "2019-08-22T15:49:27Z")

</div>



---

<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:** [August 22, 2019, 5:25pm UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/2 "2019-08-22T17:25:32Z")

</div>

You can filter them out after the fact at least

For only ! lines  
&nbsp;&nbsp;&nbsp;{{ print\_output.stdout\_lines | reject('equalto', '!') | list }}

All lines starting with !  
&nbsp;&nbsp;&nbsp;{{ print\_output.stdout\_lines | reject('search', '^!') | list }}

---

<div class="post-metadata">

**Author:** ![Steven\_Williams](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Steven\_Williams](https://forum.ansible.com/u/Steven_Williams)\
**Post date:** [August 22, 2019, 6:24pm UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/3 "2019-08-22T18:24:02Z")

</div>

Where would this go within the yml file?

---

<div class="post-metadata">

**Author:** ![Steven\_Williams](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Steven\_Williams](https://forum.ansible.com/u/Steven_Williams)\
**Post date:** [August 22, 2019, 7:21pm UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/4 "2019-08-22T19:21:27Z")

</div>

Doesn’t seem to work.

---

<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:** [August 22, 2019, 9:16pm UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/5 "2019-08-22T21:16:06Z")

</div>

You could give us the courtesy and give us the error message, we are not mind readers.

But your indentation is not correct and you need to remove the dash on debug.

---

<div class="post-metadata">

**Author:** ![Steven\_Williams](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@Steven\_Williams](https://forum.ansible.com/u/Steven_Williams)\
**Post date:** [August 23, 2019, 12:08am UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/6 "2019-08-23T00:08:52Z")

</div>

There is not error. It runs but doesn’t remove the “!”.

> * * *
> 
> - name: show version and other user level commands
> 
> hosts: IOL\_Routers
> 
> gather\_facts: false
> 
> connection: network\_cli
> 
> become: yes
> 
> tasks:
> 
> - name: run multiple commands on remote nodes
> 
> ios\_command:
> 
> commands:
> 
> - show run
> 
> register: print\_output
> 
> - name: result of running commands above
> 
> debug: msg=“{{ print\_output.stdout\_lines | reject(‘equalto’, ‘^!’) | list }}”

bnapwks120:ansible stevenwiliams$ ansible-playbook showrunrv1.yml -u cisco -k

SSH password:

PLAY [show version and other user level commands] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [run multiple commands on remote nodes] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [R02]

ok: [R04]

ok: [R01]

ok: [R03]

TASK [result of running commands above] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [R02] =\> {

“msg”: [

[

“Building configuration…”,

“”,

“Current configuration : 1075 bytes”,

“!”,

“! Last configuration change at 18:03:17 EET Thu Aug 22 2019 by cisco”,

“!”,

“version 15.4”,

“service timestamps debug datetime msec”,

“service timestamps log datetime msec”,

“no service password-encryption”,

“!”,

“hostname R02”,

“!”,

“boot-start-marker”,

“boot-end-marker”,

“!”,

“aqm-register-fnf”,

“!”,

“!”,

“no aaa new-model”,

“clock timezone EET 2 0”,

“mmi polling-interval 60”,

“no mmi auto-configure”,

“no mmi pvc”,

“mmi snmp-timeout 180”,

“!”,

“!”,

“!”,

“!”,

“!”,

“!”,

“”,

“”,

“!”,

“!”,

“!”,

---

<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:** [August 23, 2019, 6:58am UTC](https://forum.ansible.com/t/anyway-to-get-output-without-all-the/31102/7 "2019-08-23T06:58:53Z")

</div>

If you look at my post you'll see that you are mixing the syntax together.  
equalto is without the caret and search is with caret character.
