Arexx (91/92)

From:Neil Bothwick
Date:1 Feb 2000 at 10:12:56
Subject:Re: Converting To AmiGuide

From: "Neil Bothwick" <neil@wire.net.uk>

Rick Giles said,

> But this part would be too cumbersome, even for me, to be
> done one line at a time. I want to take the blocks of
> text and make each a file of its own.

> ie (snipped in size)...

> *** Update: Israelis leave more of West Bank

> JERUSALEM (AP) - The handover was quick and unemotional. An Israeli
> officer shook hands with Palestinian officials and muttered "Bye,
> folks" before he led a convoy of jeeps out of an Israeli army base in

> *** Norway rescue effort a disaster

> RENA, Norway (AP) - It was a rescue worker's nightmare. Intense heat
> from the burning trains. Freezing cold of a Norwegian winter.

> So what I want to do, is to turn those two blocks into
> two text files that an amigaguide can linke to. One will
> be called ***Update:Israeli, the other ***Norwayrescuee.

This will do it for you

call open(in,'filename1','R')
buf = readch(in,65536)
do until eof(in) & buf = ''
parse var buf Headline '0a'x Body '***' buf
Headline = strip(Headline)
Body = strip(Body,'B','0a'x)
/* Write details to file here */
say Headline
say Body
if length(buf) < 32768 then buf = buf||readch(in,32768)
end
call close(in)

It puts the header and the body into the two variables, you'll have to
check the header for illegal filename characters (like ':'). something
like

Headline = translate(Headline,'',':/~\#?*','_')

would replace any illegal character with an underscore.

Neil



Neil Bothwick - New Media Editor, Amiga Active Magazine
Connected via Wirenet - http://www.wire.net.uk
The UK's first Amiga-only internet access provider


I've got the taglines if you've got the time!

--------------------------- ONElist Sponsor ----------------------------

GET A NEXTCARD VISA, in 30 seconds. Get rates as low as 0.0 percent
Intro APR and no hidden fees. Apply NOW.
<a href=" http://clickme.onelist.com/ad/NextcardCreativeCL ">Click Here</a>

------------------------------------------------------------------------

ARexx mailing list - No flames, no overquoting, no crossposting. Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com