On 3/14/2008 2:49 AM, tbh wrote:
> thanks, Ed,
>
>>Someone had suggested you do something like this:
>>
>>base="f30"
>>unpackHourlyWebLogs.bash 11 | gawk 'tolower($5) ~ "^/'"$base"'/" {print
>>$3,$5,$6} NR==10{exit}'
>>
>>to use a shell variable in the middle of your awk script. Don't do that
as
>>it
>>can lead to hard-to-diagnose failures, e.g.:
>
>
> as it happens i still haven't managed to get that variation going, so
i've
> given up for now. i have only 3 cases for "base" in my current data
> collection, so it's simple enough to run three commands. this even has
some
> other advantages relating to how i'll use the data.
>
> i guess it's instructive to me that this appears non-trivial (and even a
bit
> controversial?) in a language as mature as awk.
No, it's absolutely trivial and not controversial at all.
Ed.


|