Processing element sets

Allen Thomson (thomsona@netcom.com)
Mon, 29 Jul 1996 18:26:37 -0700

dbishop@kodak.com (David Bishop) spake:

>I typically download elements at work, put them on a PC floppy and run
>them on Quicksat on my PC at home.  One thing that I need is a good
>satellite elements digester, something that can read e-mail messages,
>pull out elements, sort them, and put them into a file.


   If you you're running UNIX or have a UNIXlike set of utilities,

grep '^[12] [012][0-9]' mailfile > elefile

will extract the two-line elements pretty well.  You then have to get 
them into the three-line form used by most tracking programs. The shareware
ASCII editor PCWrite will do this handily,  or you can use a small perl
script or QBASIC program.

   Here's an example of a qbasic program which will extract elements and put
them into three-line form (I'm writing this freeform, so there may be a bug 
or three; the general idea should be clear.)

OPEN "MAILFILE" FOR INPUT AS #1
OPEN "ELEFILE" AS #2

WHILE NOT EOF(1)

 LINE INPUT #1, A$

 IF LEFT$(A$,2) = "1 " AND LEN(A$) = 69 THEN
  LINE0$ = MID$(A$,3,6)
  LINE1$ = A$
 ELSEIF
  LEFT$(A$,2) = "2 " AND LEN(A$) = 69 THEN
   PRINT #2, LINE0$
   PRINT #2, LINE1$
   PRINT #2, A$
 ELSE
  LINE0$ = ""
  LINE1$ = ""
 END IF

WEND
CLOSE
END


   The LEN$(A$) = 69 is a validity checker. You can AND in others, such as
position of literals, decimal points and blanks if you like, but I've
found that that's not really needed.

   If you want to do sort and uniq on the elsets, I recommend putting them
into "one-line" form ( LINE1$ + " N " + LINE2$ is what I use ), process 
them, and reconvert when it comes time to use them in prediction programs.