For Programmers: Free Programming Magazines  


Home > Archive > AWK > February 2008 > Re: awk & shell variables containing blanks









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: awk & shell variables containing blanks
Bob Harris

2008-01-17, 9:59 pm

In article <478fe20b$0$70962$dbd4d001@news.wanadoo.nl>,
"Mark" <huijstee@hotmail.com> 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
Pirindingo

2008-01-18, 5:49 am

Hilary Duff and Jessica Alba Pussy Licking & Fighting!
http://www.thetubebender.com/Window....asp?vid=726071
Butt

2008-02-03, 12:46 am

Helen Hunt and Olsen Twins Doing Hot Bottle Insertion!
http://www.bestbloggin.com/WatchMovie?vid=726648
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com