Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Re: Duplicated ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 8 Topic 2180 of 2236
Post > Topic >>

Re: Duplicated output with no condition (easy one)

by Atropo <lxvasquez@[EMAIL PROTECTED] > Mar 7, 2008 at 04:11 AM

On 7 mar, 01:53, Lorenz <loren...@[EMAIL PROTECTED]
> wrote:
> >ls -ltr|awk 'split($8,a,":");t=3Dt+a[2] END {print t,NR ,t/NR }'
>
> what you have here is three rules whereof two have no explicit action.
> That is equivalent to:
>
> =A0 =A0 =A0 =A0 ls -ltr|awk 'split($8,a,":") {print} \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=A0t=3Dt+a[2] =
{print} \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0END
{print =
t,NR ,t/NR }'
> --
>
> Lorenz

Thanks Patrick,Lorenz

Patrick "the braces turn those two patterns into a single action which
will
be evaluated for each input record. "

but then the split and the sum will evaluate to true.   it will not
produce output but calculate twice.??

ls -ltr|awk '{split($8,a,":");t=3Dt+a[2]} END {print t,NR ,t/NR }'
193 14 13.7857




 8 Posts in Topic:
Duplicated output with no condition (easy one)
Atropo <lxvasquez@[EMA  2008-03-06 13:45:07 
Re: Duplicated output with no condition (easy one)
Atropo <lxvasquez@[EMA  2008-03-06 14:00:25 
Re: Duplicated output with no condition (easy one)
ptjm@[EMAIL PROTECTED] (  2008-03-07 04:32:59 
Re: Duplicated output with no condition (easy one)
Lorenz <lorenznl@[EMAI  2008-03-07 06:53:20 
Re: Duplicated output with no condition (easy one)
Atropo <lxvasquez@[EMA  2008-03-07 04:11:46 
Re: Duplicated output with no condition (easy one)
Ed Morton <morton@[EMA  2008-03-07 07:23:12 
Re: Duplicated output with no condition (easy one)
gazelle@[EMAIL PROTECTED]  2008-03-07 13:33:43 
Re: Duplicated output with no condition (easy one)
Lorenz <lorenznl@[EMAI  2008-03-07 14:32:57 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 0:40:25 CDT 2008.