On Sun, 23 Jul 2006 10:20:02 -0400
Michael Stone <[EMAIL PROTECTED]> wrote:

> On Sun, Jul 23, 2006 at 09:48:24AM -0400, AC wrote:
> >While we can devise many roundabout ways to parse such output, it
> >would be better to do the coding once and encapsulate that function
> >in some utility, either a new one or an existing one well suited to
> >it...
> 
> Which is why I suggested perl and awk or even sed. They've been
> around a really long time, and they are suited for parsing
> complicated formats.

I don't understand.  'perl', 'awk', and 'sed' are, (to varying degrees),
general purpose languages, but 'cut' is a single purpose utility.
Solving a problem in a general purpose language does little to improve a
single purpose utility.

It's puzzling that you say: "complicated formats".  Are you
suggesting that the Bourne shell's traditional positional parameters
constitute a "complicated" format, or are relatively more complicated
than the fixed-length fields that 'cut' already supports?  If so, that
is a debatable point -- it might be argued that the shell is a much
_simpler_ format, because there's _less_ for humans to remember, since
there's no need for users to think about the widths of white space
delimiters.  A math analogy:  Topology is "simpler" than Euclidean
Geometry because Topology disregards angles and length.

Granted, in some cases a simpler format may be harder to program, and
perhaps this is such a case -- but it's not especially hard, since every
Bourne compatible shell already does it.  For maximum programmer
laziness 'cut' could even call the shell to do its parsing, then
translate that to a fixed length data format, then do
whatever it needs to.

Speculation:  apparently we're using terms like 'complicated' and
'simple' as applied to data formats in different ways -- I tend to
use these terms from an abstract view, whereas you seem to be (correct
me if I'm wrong) using them from the view of how difficult they'd be to
program, or reprogram and retrofit.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to