by di98mase <di98mase@[EMAIL PROTECTED]
>
Feb 7, 2008 at 05:45 AM
On 7 Feb, 13:51, Janis <janis_papanag...@[EMAIL PROTECTED]
> wrote:
> On 7 Feb., 11:28, di98mase <di98m...@[EMAIL PROTECTED]
> wrote:
>
> > Hi all,
>
> > I have a problem. I would like to search trough a file for a pattern.
> > How do I make sure that the script does not hang? This is my current
> > solution:
>
> > /value/
> > {
>
> Didn't you mean
>
> =A0 /value/ {
>
> (i.e. bracket on the same line as the action)
>
> > =A0 =A0foundLog=3D0
>
> This variable is never set to any other value.
>
> > =A0 =A0# from this line and forward search for x.
> > =A0 while (foundLog=3D=3D0)
> > =A0 {
> > =A0 =A0 =A0 getline
>
> Don't use getline; awk does that for you implicitly.
>
> > =A0 =A0 =A0 if ($4=3D=3Dexpected value)
>
> Put constant strings in double quotes.
>
> > =A0 =A0 =A0 {
> > =A0 =A0 =A0 =A0 =A0return 1
> > =A0 =A0 =A0 =A0}
> > =A0 =A0 }
>
> > }
>
> Instead of all that anove you maybe mean...
>
> =A0 /value/ { flag =3D 1 }
> =A0 flag && $4 =3D=3D "another value" { exit 1 }
>
> Janis
>
>
>
>
>
> > The problem is that the script hangs when it cant find "value". How
> > could I avoid this? I would like to add some check for EOF.
>
> > /di98mase- D=F6lj citerad text -
>
> - Visa citerad text -
Hi Janis,
sorry to take your time with this pointless message. I will start a
new thread with a proper question instead. Thanks anyway.
/di98mase