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.


|