lundi 2 novembre 2015

how to grep a pattern containing a variable?

I can't seem to get the syntax right: I want grep to count the lines which start with a "0" and contain the phrase in the variable "phrase"

I tried:

cut -f1,5 file.txt|grep -c 0*${phrase}*

(the cut is working as it should, it isn't really part of the problem) but it won't work. what am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire