Discussion:
Windows Regina REXX and CR vs CRLF
(too old to reply)
Arthur T.
2021-04-23 06:06:51 UTC
Permalink
I'm using Regina REXX on Windows, and I'd like to read a file
linewise, but the input lines are delimited with CR (x'0d') rather
than the Windows standard of CRLF (x'0d0a'). These are old-fashioned
Word (.doc) files - about 200 of them.

Is there an easy way to do this, or am I going to have to do
character I/O and separate the lines myself? BTW, I usually use
RegStemRead for input, but I can fall back to linein if that can be
made to work.

Possible ways I'll proceed if there isn't an easy way:

I could charin the entire file, changestr all x'0d' to x'0d0a', write
to a temp file, and read the temp file by lines. It wouldn't be
difficult to code, but it offends my sense of elegance, even though
the files are small enough to make it possible.

I could charin the entire file (to variable name filein), and do my
own deblocking by an iterative, fancied-up version of PARSE VAR
FILEIN LINEIN (CR) FILEIN. This at least gets rid of the need to
write and read a temp file.
--
Arthur T. - ar23hur "at" pobox "dot" com
Duke Normandin
2021-04-23 11:05:59 UTC
Permalink
On Fri, 23 Apr 2021 02:06:51 -0400
Post by Arthur T.
I'm using Regina REXX on Windows, and I'd like to read a file
linewise, but the input lines are delimited with CR (x'0d') rather
than the Windows standard of CRLF (x'0d0a'). These are old-fashioned
Word (.doc) files - about 200 of them.
Those appear to be Unix-style files. I'm almost certain that there are scripts available that will do end-of-line conversion for you from the CLI - either for a few files or an entire directory.

I'm in Rexx learning mode so I cannot help you directly with a Rexx solution. I'm still trying ti figure out how to run Regina interactively in my Linux box, i.e ``regina -i''

However, I think that we might be the only two lost souls lurking this newsgroup! :)
--
Duke
Rony
2021-04-23 14:23:33 UTC
Permalink
Post by Duke Normandin
On Fri, 23 Apr 2021 02:06:51 -0400
Post by Arthur T.
I'm using Regina REXX on Windows, and I'd like to read a file
linewise, but the input lines are delimited with CR (x'0d') rather
than the Windows standard of CRLF (x'0d0a'). These are old-fashioned
Word (.doc) files - about 200 of them.
Those appear to be Unix-style files. I'm almost certain that there are scripts available that will do end-of-line conversion for you from the CLI - either for a few files or an entire directory.
I'm in Rexx learning mode so I cannot help you directly with a Rexx solution. I'm still trying ti figure out how to run Regina interactively in my Linux box, i.e ``regina -i''
However, I think that we might be the only two lost souls lurking this newsgroup! :)
No, there are others lurking ...

---rony

P.S.: Indicating a line end with the CR character used to be used on the Apple platform (Unix used
LF, Windows CR-LF).
Steven Levine
2021-04-23 16:29:42 UTC
Permalink
On Fri, 23 Apr 2021 14:23:33 UTC, Rony <***@wu-wien.ac.at>
wrote:

Hi all,
Post by Rony
Post by Duke Normandin
However, I think that we might be the only two lost souls lurking this newsgroup! :)
No, there are others lurking ...
By definition, lurkers lurk. :-)

Steven
--
---------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net>
DIY/ArcaOS/Warp etc. www.scoug.com www.arcanoae.com www.warpcave.com
---------------------------------------------------------------------
Gil Barmwater
2021-04-23 17:01:37 UTC
Permalink
Post by Steven Levine
Hi all,
Post by Rony
Post by Duke Normandin
However, I think that we might be the only two lost souls lurking this newsgroup! :)
No, there are others lurking ...
By definition, lurkers lurk. :-)
Steven
And there are others...
--
Gil Barmwater
Arthur T.
2021-04-23 22:15:39 UTC
Permalink
Post by Steven Levine
Hi all,
Post by Rony
Post by Duke Normandin
However, I think that we might be the only two lost souls lurking this newsgroup! :)
No, there are others lurking ...
By definition, lurkers lurk. :-)
Lurkers are the only smart ones on Usenet. :-)
Why, thank you...
oh bugger
--
Arthur T. - ar23hur "at" pobox "dot" com
Watson
2021-04-24 10:28:03 UTC
Permalink
Post by Steven Levine
Hi all,
Post by Rony
Post by Duke Normandin
However, I think that we might be the only two lost souls lurking this newsgroup! :)
No, there are others lurking ...
By definition, lurkers lurk. :-)
Steven
--
---------------------------------------------------------------------
DIY/ArcaOS/Warp etc. www.scoug.com www.arcanoae.com www.warpcave.com
---------------------------------------------------------------------
I confess to being a lurker. I'm sure there are others
REXX is such an easy language, extremely powerful, and I can tolerate it not being the fastest (I just run Regina on the spare PC)
The stem & interpret features are unique, to my knowledge

Regarding the OP, I'd load the whole file then parse it into a stem, then do whatever's required
JWatson
Arthur T.
2021-04-26 00:45:49 UTC
Permalink
Post by Arthur T.
I'm using Regina REXX on Windows, and I'd like to read a file
linewise, but the input lines are delimited with CR (x'0d') rather
than the Windows standard of CRLF (x'0d0a'). These are old-fashioned
Word (.doc) files - about 200 of them.
I was just about to write my own deblocking code when I decided to
try another tack. I found a free command-line utility to convert the
.doc files to .txt, and those .txt files are delimited with CRLF and
can be easily read by REXX.

Thank you all for your suggestions. If anyone cares, I was going to
Post by Arthur T.
I could charin the entire file (to variable name filein), and do my
own deblocking by an iterative, fancied-up version of PARSE VAR
FILEIN LINEIN (CR) FILEIN.
--
Arthur T. - ar23hur "at" pobox "dot" com
Loading...