Dec 062017
 
Reformat line length of an ASCII text file.
File REFORM10.ZIP from The Programmer’s Corner in
Category Word Processors
Reformat line length of an ASCII text file.
File Name File Size Zip Size Zip Type
REFORMAT.DOC 5986 2415 deflated
REFORMAT.EXE 17978 9102 deflated
SAMPLE.TXT 1217 586 deflated

Download File REFORM10.ZIP Here

Contents of the REFORMAT.DOC file


**********************************

REFORMAT version 1.0

A text reformatting utility


(c) 1990 by Timothy C. Barmann

**********************************

REFORMAT is a utility for IBM compatibles to reformat the line length of any
ASCII text file. The program will take a text file, with lines of any length,
and reformat them to the length you specify. For example, if you have a text
file that is 80 characters per line (such as this file you're reading),
REFORMAT can change the length of each line to say, 65 characters per line, or
whatever length you like. The program will save the reformatted text to a new
file you specify. REFORMAT can also be used to strip all carriage return/line
feeds that mark the end of a line in ASCII text files, except those CR/LF's
that end paragraphs, so the files can be used by certain word processors.

HOW TO USE REFORMAT
-----------------

A>REFORMAT infile.ext outfile.ext new-line-length

Where:
infile.ext -- file to be reformatted
outfile.ext -- file the reformatted text is to be saved to
new line length -- length in characters to reformat text to
(Line length must be between 0 and 1500 characters.)

EXAMPLE: A>REFORMAT LETTER.TXT LETTER.FMT 65

will reformat the file LETTER.TXT to 65 characters per line and save the new
file in LETTER.FMT.

Try REFORMAT on the SAMPLE.TXT file included in this package:

A>REFORMAT SAMPLE.TXT SAMPLE.FMT 35

To see the results:

A>TYPE SAMPLE.FMT

FEATURES
------
-Setting a new line length of 0 performs a special function. In this case, all
CR/LF's will be stripped except those that mark the end of a paragraph.

-REFORMAT can reformat a text file to any line length from lines that are 1
character wide up to lines that are 1500 characters wide. If you set a line
length that is shorter than the length of some words in the infile (except 0),
REFORMAT will truncate the long words and give you a warning that it has done
so. For example, if you type in

A>REFORMAT FRANK.TXT HARRY.TXT 10

and you have the word "ballazoonga" in FRANK.TXT, the word will be truncated to
"ballazoon*" in HARRY.TXT. You will get a warning on the screen that the word
was cut off. Truncated words will end with an asterisk (*) in outfile. You
will not normally need to worry about this unless you set a very narrow line
length.

-REFORMAT will report how many lines are in the new file.

Hint: REFORMAT works best on text files without special formatting such as
centered text. REFORMAT will try to combine short lines (such as an address)
into one long line if the line length you specify is long enough. To prevent
this from happening, indent these short lines in infile by at least one space
or tab, or separate the lines by a CR/LF. Otherwise, open the resulting
outfile with your text editor and fix these trouble spots.

USES
--

-Let's say your printer can print compressed type at 160 characters per line.
You have a file that is 80 characters per line and you don't want to go to the
trouble of starting up your word processor and reformatting each paragraph
manually. REFORMAT will automatically change the line length to the length you
specify.

-Reformatting a text file to a line length of 0 will get rid of all carriage
return/line feeds in a file except those that mark the end of a paragraph. Some
word processing programs like XYWRITE do not want a CR/LF to mark the end of a
line as most ASCII files do. REFORMAT can be used in this method to convert
ASCII files to a format XYWRITE can read.

BATCH PROCESSING
--------------

You can process a number of files by creating a batch file with the names of
the files listed one by one. For example, a batch file like this would work
just fine:

REFORMAT SUSIE.TXT SUSIE.FMT 65
REFORMAT MYLIST.DOC NEWLIST.DOC 80
REFORMAT FRANK.TXT HARRY.TXT 25

LIMITATIONS
---------

-Outfile line length must be between 0 and 1500 characters.
-Outfile MUST have a different name than Infile.
-DOS wildcards (filename.*) are not supported.
-Hyphenation is not supported.

ASCII TEXT FILE CONVENTIONS
-------------------------

To automate the process of reformatting, a number of things about ASCII text
files had to be assumed:

-REFORMAT will reformat text using only one space following any period,
question mark, exclamation point, or colon. The infile can have as many spaces
after these characters as you can type in, but the resulting outfile will have
only one space after any of these characters.

-A new paragraph in a normal ASCII text file is designated by a carriage return
and line feed (ASCII 13 and 10) followed by one or more of any of the
following: another CR/LF, space(s) or tab(s). REFORMAT will keep as paragraphs
text that follow these normal ASCII file conventions.

-Tab characters are treated as 8 spaces, just like DOS does.

BUG REPORT
--------

If you find any pesky bugs in this program, please let me know. If you would
like REFORMAT to do something it doesn't do already, I'd like to hear from you
too. I can be reached through CompuServe: 72070,652 or at the address below.
Please specify version number you are using.

IF YOU LIKE REFORMAT
------------------

...And you plan to use it, please send the registration fee of $10 to:

Timothy C. Barmann
87 Marbury Ave.
Pawtucket, RI 02860

I will send you a registered copy of REFORMAT along with the TURBO C source
code.

WATCH FOR
-------

Another text file utility, COLUMNS, which makes a page of columns from any
ASCII text file. You specify column width, character width within columns, and
page length. Great for creating pages of a phone list or a simple newsletter.
A lot easier than trying to figure out WordPerfect's column commands. To get a
copy of COLUMNS, send $10 to me at the above address. You'll get the TURBO C
source code also.


 December 6, 2017  Add comments

Leave a Reply