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: Is that pro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 16 Topic 2155 of 2241
Post > Topic >>

Re: Is that problem for awk?

by William James <w_a_x_man@[EMAIL PROTECTED] > Feb 9, 2008 at 01:00 AM

On Feb 8, 11:29 am, Ed Morton <mor...@[EMAIL PROTECTED]
> wrote:
> On 2/8/2008 11:11 AM, Janis Papanagnou wrote:
>
> > Luuk wrote:
> <snip>
> >>normally i use to do:
> >>awk '{ sub(/./,NR); print $0 }' file
>
> >>which i indeed something longer... ;-)
>
> > You can shorten that a bit without sacrificing the action block by
>
> >    awk '{ sub(/./,NR) } 1' file
>
> > Personally I consider the concatenation of sub() and 1
>
> >    awk 'sub(/./,NR) 1' file
>
> > as a hack; it's an unnecessary level of obfuscation[*].

True.

>
> I'm all about conciseness.

What arrogance!  No one here cares what little Ed is
about.  (Note that he implies that he cares
nothing for correctness or readability.)

>    Within that, normally, I'd trade clarity over brevity
> if there is a trade-off as in this case BUT in this particular case, I
really
> like favoring brevity since it's a very small script so there isn't a
lot of
> clutter with other details and to understand what awk is doing in that
script,
> you have to understand how awk works in terms of condition-action
segments,
> string concatenation, default actions, and return codes so to understand
what
> the above is doing requires you to know a lot that you SHOULD know
anyway before
> doing any awk programming.

Shockingly arrogant nonsense.  One doesn't have to know
everything about a programming language before he starts
to use that language.  From "The AWK Programming Language":

  Chapter 1 is a tutorial on the bare minimum necessary
  to get started; after reading even a few pages, you
  should have enough information to begin writing useful
  programs.

Note to newbies.  Don't be fooled by Ed's attempts to
pass himself off as an exemplary awk programmer.  He
has a record of posting buggy, untested code and code
that solves less of the problem than what has
already been posted by others.




 16 Posts in Topic:
Is that problem for awk?
Kurda Yon <kurdayon@[E  2008-02-07 12:37:10 
Re: Is that problem for awk?
Ed Morton <morton@[EMA  2008-02-07 14:45:08 
Re: Is that problem for awk?
"Luuk" <luuk  2008-02-08 13:50:57 
Re: Is that problem for awk?
Ed Morton <morton@[EMA  2008-02-08 08:58:17 
Re: Is that problem for awk?
Luuk <Luuk@[EMAIL PROT  2008-02-08 16:19:40 
Re: Is that problem for awk?
Ed Morton <morton@[EMA  2008-02-08 10:19:07 
Re: Is that problem for awk?
gazelle@[EMAIL PROTECTED]  2008-02-08 16:48:13 
Re: Is that problem for awk?
Janis Papanagnou <Jani  2008-02-08 18:11:32 
Re: Is that problem for awk?
Ed Morton <morton@[EMA  2008-02-08 11:29:42 
Re: Is that problem for awk?
Janis Papanagnou <Jani  2008-02-08 19:11:04 
Re: Is that problem for awk?
"Luuk" <luuk  2008-02-08 10:05:11 
Re: Is that problem for awk?
William James <w_a_x_m  2008-02-09 01:00:53 
Re: Is that problem for awk?
Luuk <Luuk@[EMAIL PROT  2008-02-09 10:34:28 
Re: Is that problem for awk?
gazelle@[EMAIL PROTECTED]  2008-02-09 13:09:48 
Re: Is that problem for awk?
Ed Morton <morton@[EMA  2008-02-09 09:49:35 
Re: Is that problem for awk?
Andrew Schorr <aschorr  2008-02-09 10:55:04 

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 4:41:57 CDT 2008.