Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] escaping variables in bash


Alexander Samad wrote:
Hi

No the jist was that
I wanted to so something like this


awk '/regex/ {awk code}'

Ah Ha!
This is a question that I had asked on this list some time back under the subject "Awk parameter as a search string". Roger Barnes offered the answer below,

HTH

Pete.

--
Roger Barnes wrote:

/regexp/ is considered a constant, so it won't let you put any variables in the pattern


This page:
	http://www.math.utah.edu/docs/info/gawk_5.html#SEC32
reckons that
	$0 ~ search { printf("%s\n",$0) }
will work ... it did for me.

HTH,
- Rog ... just learnt some awk  :)