# Error when trying to grep something from a file

**URL:** <https://forum.ansible.com/t/error-when-trying-to-grep-something-from-a-file/27879>\
**Category:** Ansible Project\
**Created:** [June 27, 2018, 1:57am UTC](https://forum.ansible.com/t/error-when-trying-to-grep-something-from-a-file/27879 "2018-06-27T01:57:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kallu\_Srikanth](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@Kallu\_Srikanth](https://forum.ansible.com/u/Kallu_Srikanth)\
**Post date:** [June 27, 2018, 1:57am UTC](https://forum.ansible.com/t/error-when-trying-to-grep-something-from-a-file/27879/1 "2018-06-27T01:57:22Z")

</div>

Hi,

dpiesa@cwypatchdev:/etc/ansible\> ansible all -m command -a “cat /etc/oratab | grep -i ^AGENT | cut -f 2 -d :”

[vmcwy60158.prod.acxiom.net](http://vmcwy60158.prod.acxiom.net) | FAILED | rc=1 \>\>

cat: invalid option – ‘i’  
Try `cat --help’ for more information.non-zero return code

Can I get help please ? what am I missing above?

This is the expectation

[root@vmcwy60158 skallu]# cat /etc/oratab | grep -i ^AGENT | cut -f 2 -d :  
/u01/app/oracle/product/12.1.0/agent12c/core/12.1.0.5.0

---

<div class="post-metadata">

**Author:** ![Kallu\_Srikanth](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@Kallu\_Srikanth](https://forum.ansible.com/u/Kallu_Srikanth)\
**Post date:** [June 27, 2018, 2:03am UTC](https://forum.ansible.com/t/error-when-trying-to-grep-something-from-a-file/27879/2 "2018-06-27T02:03:17Z")

</div>

Found the answer, should have used shell instead of command
