mardi 16 mars 2021

grep pattern match with multiple variables

I have been searching around for over an hour and I am not quite finding what I am looking for. I am trying to perform a grep match to make sure the syntax in a command is correct before proceeding.

Contents of file:

deploy type:apptype1 artifact:coolio version:1.1.1 in dev

What I am looking for is to allow multiple types, artifact, version and allow for only dev or qa. Any other text added or missing should fail.

What I have tried so far is:

grep -ie "deploy type:apptype1\|apptype2\|apptype3 artifact:.*version:.*in dev\|qa file

The problem is if I add additional text or even change "in" to "on" it still matches. I suspect it is only matching the first part and not the entire line like I am wanting?

Aucun commentaire:

Enregistrer un commentaire