Re: question

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thank you very much Mike!

Chris


--- Sabal.Mike at notations.com wrote:
> 
> This program has always done the trick for me.  I
> modified it a bit in
> the email to fit your needs, so a small typo or two
> may have crept in.
> 
> HTH,
> Michael J. Sabal
> 
> ---------- Program follows -----------------
> 
> without type_check
> -- split file into separate parts
> 
> atom extctr, infid, outfid
> extctr = 1
> 
> procedure main()
> 
>   object options, temp, current_tp
>   options = command_line()
> 
>   if length(options)<4 then
>     puts(1,"The correct syntax is SPLTFLAT BIGFILE
> SMALLFILE'S_PREFIX.\n")
>     puts(1,"Ex: SPLTFLAT MYFLAT.850 TODAY\n\n")
>     puts(1,"Note: Do NOT use an extension with the
> second
> argument.\n")
>     abort(1)
>   end if
> 
>   infid = open(options[3],"r")
>   if infid < 1 then
>     puts(1,"Couldn\'t open "&options[3]&"\n")
>     abort(2)
>   end if
>   outfid =
> open(options[4]&sprintf(".%03d",extctr),"w")
>   if outfid < 1 then
>     puts(1,"Couldn\'t open
> "&options[4]&sprintf(".%03d",extctr)&"\n")
>     abort(2)
>   end if
> 
>   temp = gets(infid)
>   while sequence(temp) do
>     puts(outfid,temp)
>     temp = gets(infid)
>     if sequence(temp) and length(temp)>=6 and
> compare(temp[1..6],"******")=0 then
>       close(outfid)
>       extctr = extctr + 1
>       outfid =
> open(options[4]&sprintf(".%03d",extctr),"w")
>       if outfid < 1 then
>         puts(1,"Couldn\'t open
> "&options[4]&sprintf(".%03d",extctr)&"\n")
>         abort(2)
>       end if
>     temp = gets(infid) 
>    end if
>   end while
> 
>   close(infid)
>   if outfid > 0 then
>     close(outfid)
>   end if
> 
> end procedure
> main()
> 
> ---------------- End program ----------------------
> 
> >>> csaik2002 at yahoo.com 12/31/02 02:36PM >>>
> 
> In Eu, is there an easy way to split one large file
> into dozens of smaller files?
> 
> For instance, if I have one giant source file, and I
> want to create a new file everytime I read a line
> that
> begins with "******", how is that done?
> 
>
> 
> 
> TOPICA - Start your own email discussion group.
> FREE!
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu