From: Sidney Lambe on
On comp.unix.shell, Ed Morton <mortonspam(a)gmail.com> wrote:
> On 3/28/2010 2:42 PM, Sidney Lambe wrote:
>> On comp.unix.shell, Ed Morton<mortonspam(a)gmail.com> wrote:
>>> On 3/27/2010 9:28 PM, Sidney Lambe wrote:

[delete awk propaganda from a fanatic]

Sed and /bin/printf can do anything awk can do
and are less than half the size combined. (Referring
to gawk-3.1.1).

They are fun to use and awk is way too complex for such
a limited tool.

Sid


From: bsh on
Sidney Lambe <sidneyla...(a)nospam.invalid> wrote:
> Ed Morton <mortons...(a)gmail.com> wrote:
> > Sidney Lambe wrote:
> > > Ed Morton<mortons...(a)gmail.com>  wrote:
> > > > Sidney Lambe wrote:

> Sed and /bin/printf can do anything awk can do
> and are less than half the size combined. (Referring
> to gawk-3.1.1).

Weeell....

While it is true that I have written a k/sh lexical scanner
in sed(1) -- and BTW a parser in awk(1) -- and in doing
so have gone far, far past the pale insofar as pertains
to Lee E. McMahon's proforma of sed(1) introduced
in v7 Unix of 1978 -- I wouldn't say that sed(1) is even
remotely adapted to the kind of flow-of-control that
n/g/awk(1) implements.

Sure, there is a formal proof that there exists
a sufficient Turing Machine to accomplish any
decidable algorithm, but I wouldn't want to be the
one to implement it! This is what non-trivial
programming in sed(1) can feel like; I would
rather program a moon landing in BASIC!

(Check out "dc.sed" by Greg Ubben!
http://sed.sf.net/grabbag/scripts/dc.sed
http://sed.sf.net/local/scripts/dc.sed
http://ppt.perl.org/commands/dc/dc.gsu
"Overview Of How The dc.sed Script Works": sed.sf.net/grabbag/scripts/
dc_overview.htm
)

> They are fun to use and awk is way too complex
> for such a limited tool.

Odd. I have tried for years to convince college
professors of freshman programming in C, that
starting with nawk(1) is a _much_ gentler
introduction to programming than throwing
them directly into *that* snakepit of a language.

It's even quite efficient, if indeed that is a major
criterion of language selection of sed(1) over
nawk(1):

http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html

=Brian
From: Sidney Lambe on
On comp.unix.shell, bsh <brian_hiles(a)rocketmail.com> wrote:
> Sidney Lambe <sidneyla...(a)nospam.invalid> wrote:
>> Ed Morton <mortons...(a)gmail.com> wrote:
>> > Sidney Lambe wrote:
>> > > Ed Morton<mortons...(a)gmail.com> =A0wrote:
>> > > > Sidney Lambe wrote:
>
>> Sed and /bin/printf can do anything awk can do
>> and are less than half the size combined. (Referring
>> to gawk-3.1.1).
>
> Weeell....
>
> While it is true that I have written a k/sh lexical scanner
> in sed(1) -- and BTW a parser in awk(1) -- and in doing
> so have gone far, far past the pale insofar as pertains
> to Lee E. McMahon's proforma of sed(1) introduced
> in v7 Unix of 1978 -- I wouldn't say that sed(1) is even
> remotely adapted to the kind of flow-of-control that
> n/g/awk(1) implements.

You aren't using just sed. You are using the shell, too.
And I said sed and /bin/printf, not just sed.

> Sure, there is a formal proof that there exists
> a sufficient Turing Machine to accomplish any
> decidable algorithm, but I wouldn't want to be the
> one to implement it! This is what non-trivial
> programming in sed(1) can feel like; I would
> rather program a moon landing in BASIC!

That's why you keep these scripts in an organized
archive so that you can use them as templates
when similar need arise.

For a simple example, I don't type this every time I need it.
It's in a file:

's/\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)\(\)//'
or:
'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'



>
> (Check out "dc.sed" by Greg Ubben!
> http://sed.sf.net/grabbag/scripts/dc.sed
> http://sed.sf.net/local/scripts/dc.sed
> http://ppt.perl.org/commands/dc/dc.gsu
> "Overview Of How The dc.sed Script Works": sed.sf.net/grabbag/scripts/
> dc_overview.htm
> )
>
>> They are fun to use and awk is way too complex
>> for such a limited tool.
>
> Odd. I have tried for years to convince college
> professors of freshman programming in C, that
> starting with nawk(1) is a _much_ gentler
> introduction to programming than throwing
> them directly into *that* snakepit of a language.
>
> It's even quite efficient, if indeed that is a major
> criterion of language selection of sed(1) over
> nawk(1):
>
> http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html
>
>=3DBrian

You know, I am talking about ordinary usage. Not trying
to use sed for NASA engineering projects.

Sid


From: bsh on
Sidney Lambe <sidneyla...(a)nospam.invalid> wrote:
> bsh <brian_hi...(a)rocketmail.com> wrote:
> > Sidney Lambe <sidneyla...(a)nospam.invalid> wrote:
> > > Ed Morton <mortons...(a)gmail.com> wrote:
> > > > Sidney Lambe wrote:
> > > > > Ed Morton<mortons...(a)gmail.com> =A0wrote:
> > > > > > Sidney Lambe wrote:

> You aren't using just sed. You are using the shell, too.
> And I said sed and /bin/printf, not just sed.

You don't have to be combative; I understand the context.

(And no, I am _not_ using the shell too: the scanner/parser
scripts I was mentioning are actions within a makefile, and
are directly exec'ed without the intervention of the shell).

> You know, I am talking about ordinary usage. Not trying
> to use sed for NASA engineering projects.

Neither are freshmen in their first C programming class.

=Brian
From: Sidney Lambe on
On comp.unix.shell, bsh <brian_hiles(a)rocketmail.com> wrote:
> Sidney Lambe <sidneyla...(a)nospam.invalid> wrote:
>> bsh <brian_hi...(a)rocketmail.com> wrote:
>> > Sidney Lambe <sidneyla...(a)nospam.invalid> wrote:
>> > > Ed Morton <mortons...(a)gmail.com> wrote:
>> > > > Sidney Lambe wrote:
>> > > > > Ed Morton<mortons...(a)gmail.com> =A0wrote:
>> > > > > > Sidney Lambe wrote:
>
>> You aren't using just sed. You are using the shell, too.
>> And I said sed and /bin/printf, not just sed.
>
> You don't have to be combative; I understand the context.

No. You don't.

> (And no, I am _not_ using the shell too: the scanner/parser
> scripts I was mentioning are actions within a makefile, and are
> directly exec'ed without the intervention of the shell).

I obviously wasn't talking about your scripts.
I was talking about using sed and printf with the shell.

>> You know, I am talking about ordinary usage. Not trying
>> to use sed for NASA engineering projects.
>
> Neither are freshmen in their first C programming class.
>
>=Brian

Good grief.


Sid