[CLUE-Tech] This should be simple...

Keith Hellman kehellman at yahoo.com
Fri Oct 25 08:49:33 MDT 2002


On Thu, Oct 24, 2002 at 10:43:02PM -0600, David Willson wrote:
> I need a way to loop through the lines of a file.  I don't want the
> whole file in one shot, I want something like this:
> 
> joe = file.open(raw-report.csv);
> myRecord = joe.readNextLine();
> myFields[] = myRecord.parseOn(",");
> 
> While(!joe.EOF) {
>   myRecord = joe.readNextLine();
>   myFields[] = myRecord.parseOn(",");
> }
> 
> Why do I want this?  Because I have a file that is laid out like a tree:
>   Willson, David, Lawrence
>          ,      , Timothy
>          , Katie, M.K.V.
>          , Evan , Patrick
>   Craft  , Chris, Micheal
> And I need it to be laid out 'flat', for lack of a better word:
>   Willson, David, Lawrence
>   Willson, David, Timothy
>   Willson, Katie, M.K.V.
>   Willson, Evan , Patrick
>   Craft  , Chris, Micheal
> 
> I need to convert all the implicit repeats into explicit/actual repeats.
> 
In the attached tar file are three different ways to do this:
- parse.sh is a shell script; I figured that's the least I could do
  since I just finished a shell scripting talk for Fundamentals :^)
- parse.py is a python script; in honor of Matt Gushee's upcoming python
  talk for Fundamentals.
- parse.c is a quick and dirty C program, in honor of, ... well ... C;
  without which none of this would be possible :^)

C++ really doesn't provide anything over C in this context.  And there you
have it, these are all the languages I know (well, will claim to know).
I actually took hieroglyphics in school - but the Egyptians did not use
the standard ASCII charset, so the language is not very expressive for
this particular task.

-- 
Keith Hellman                             #include <disclaimer.h>
kehellman at yahoo.com               from disclaimer import standard



More information about the clue-tech mailing list