by Bob Harris <nospam.News.Bob@[EMAIL PROTECTED]
>
Jan 18, 2008 at 01:08 AM
In article <478fe20b$0$70962$dbd4d001@[EMAIL PROTECTED]
>,
"Mark" <huijstee@[EMAIL PROTECTED]
> wrote:
> Hi,
>
> Currently I am experiencing a small issue with awk search patterns &
korn
> shell variables.
> I simplified my problem to the following example (which will explain
itself
> I suppose) :
>
> $ x="a b"
> $ awk '/'$x'/' <file>
> awk: line 1: runaway regular expression /a ...
>
> Can anyone tell me how to get around it? Probably a small thing, but I
> can't seem to find the answer ...
>
>
> Thanks!
>
> Mark
awk -v re="$x" '$0 ~ re { do something }' file
If you are using Sun, then look for nawk on your system, or get
gawk and install it.
Bob Harris