# Issues with using grep in Drone Pipeline

**URL:** <https://drone.discourse.group/t/issues-with-using-grep-in-drone-pipeline/4104>\
**Category:** Drone Support\
**Created:** [March 19, 2020, 9:39pm UTC](https://drone.discourse.group/t/issues-with-using-grep-in-drone-pipeline/4104 "2020-03-19T21:39:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lo\_ronk](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/lo_ronk/32/5519_2.png) [@lo\_ronk](https://drone.discourse.group/u/lo_ronk)\
**Post date:** [March 19, 2020, 9:39pm UTC](https://drone.discourse.group/t/issues-with-using-grep-in-drone-pipeline/4104/1 "2020-03-19T21:39:37Z")

</div>

Hello,

I am having some issues with drone parsing a `grep` command in my pipeline. Essentially, I am using grep to pull a version number of one of my container images in order to promote the image from dev -\> stage and eventually stage-\>prod. I am doing this through `gcloud`. My command to grab the image using `gcloud` syntax is:

` gcloud container images list-tags <my-image-repository> --filter="tags:latest" --format="table[noheading](tags)" | grep -o '\bv\w*.*'`

This command parses the correct information when I log directly into the docker container that I am using to execute this step, however, when I run it with Drone it appears to yank the `\b` from my grep command completely. I tested this with a pipeline by just running `grep -o '\bv\w*.*'` against a `test.txt` file that included a string `v1.0.30841303` and the pipeline fails out with the last step showing the following:

`+ grep -o 'v\w*.*' test.txt`

Is there something I am doing wrong or is there something in Drone that would cause it to incorrectly parse the `\b` in my grep syntax?

Thank you!

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 19, 2020, 11:44pm UTC](https://drone.discourse.group/t/issues-with-using-grep-in-drone-pipeline/4104/2 "2020-03-19T23:44:00Z")

</div>

you probably need to escape the value (e.g. `\\b`) so that yaml preserves the literal value, or you can do something like this:

```nohighlight
steps:
- |
  gcloud container images list-tags <my-image-repository> --filter="tags:latest" --format="table[noheading](tags)" | grep -o '\bv\w*.*'

```

Drone is going to unmarhsal your commands to a `[]string` variable and is then going to use these commands to generate a bash file. It will write the commands as-is and will not change them in any way. If the command is changing, it would have to be related to the yaml parsing (which is done by a third party library).
