- To: Alexander Samad <alex@xxxxxxxxxxxx>
- Subject: Re: [SLUG] escaping variables in bash
- From: Peter Rundle <prundle@xxxxxxxxxxxxxx>
- Date: Tue, 14 Sep 2004 11:21:35 +1000
- Cc: slug@xxxxxxxxxxx
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803
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 :)