DOS program

  • Thread starter Thread starter -Art-
  • Start date Start date
A

-Art-

Greetings!
Can anyone suggest a DOS app (freeware, natch) than can reformat test
via commandline.
Got a bunch of text that I need to (quickly) change from whatever
number of columns to 50 columns.

TIA,
-Art-
 
-Art- said:
Greetings!
Can anyone suggest a DOS app (freeware, natch) than can reformat
test via commandline.
Got a bunch of text that I need to (quickly) change from
whatever number of columns to 50 columns.

This is a perfect opportunity to teach yourself some scripting...
there are a few options:
- Cygwin: a bash script using "sed" should be able to do this
- Python: similar approach, you should do fine with some regex
operations (using the "re" module)

Regards,
Wald
 
Can anyone suggest a DOS app (freeware, natch) than can reformat test
via commandline.
Got a bunch of text that I need to (quickly) change from whatever
number of columns to 50 columns.

Lots of programs will do that. Try Justify:

ftp://sac-ftp.gratex.sk/utiltext/justfy15.zip

HTH.
BeAr
 
wald schreef:
This is a perfect opportunity to teach yourself some scripting...
there are a few options:
- Cygwin: a bash script using "sed" should be able to do this

There are native DOS & Win32 console builds of sed too.
(the OP might want to google for "hhsed" for one example)

IIRC there is also a Win32 console version of "par".
- Python: similar approach, you should do fine with some regex
operations (using the "re" module)

Or the "textwrap" module (available since python 2.3).
 
Can anyone suggest a DOS app (freeware, natch) than can reformat test
via commandline.
Got a bunch of text that I need to (quickly) change from whatever
number of columns to 50 columns.

Apps ported from Unix are great at text processing. Try "fold" (or
fmt or pr) in <http://unxutils.sf.net>.
 
JanC said:
wald schreef:



There are native DOS & Win32 console builds of sed too.
(the OP might want to google for "hhsed" for one example)

IIRC there is also a Win32 console version of "par".


Or the "textwrap" module (available since python 2.3).

This is probably a simple one-liner in perl, too.

Wait, what am I talking about? In perl, you can make a multithreaded
webserver a one-liner.
 
-Art- said:
Greetings!
Can anyone suggest a DOS app (freeware, natch) than can reformat test
via commandline.
Got a bunch of text that I need to (quickly) change from whatever
number of columns to 50 columns.

I wrote a utility to do this. It's not a one liner script,
unfortunately, it's a 90k console app that will reformat thousands of
files to fit your taste.

You can set a left margin, the number of spaces to indent each
paragraph, and the total number of characters per line.

It can strip x number of lines from each file, as in headers you don't
want. It removes any control characters or high ascii if selected.
Back in the old days unix-> DOS conversions left garbage characters in
the text.

http://www.woundedmoon.org/

The sm-doall.bat will allow you to set a directory and will format all
files to your specs. Or, without setting a directory, it will do the
same to all files you copy to the Work subdir.

I tried to make as safe as possible. It's hard coded for C: and must
be installed there. It only opens, reads, and closes your text files.
New ones are written into the New subdir.

By installed, I mean unzipped. It's a self extracting zip file. The
program uses an .ini file to remember your preferences and no files
are installed or created outside the program directory.
 
REM said:
I wrote a utility to do this. It's not a one liner script,
unfortunately, it's a 90k console app that will reformat thousands of
files to fit your taste.

You can set a left margin, the number of spaces to indent each
paragraph, and the total number of characters per line.

It can strip x number of lines from each file, as in headers you don't
want. It removes any control characters or high ascii if selected.
Back in the old days unix-> DOS conversions left garbage characters in
the text.

http://www.woundedmoon.org/

The sm-doall.bat will allow you to set a directory and will format all
files to your specs. Or, without setting a directory, it will do the
same to all files you copy to the Work subdir.

I tried to make as safe as possible. It's hard coded for C: and must
be installed there. It only opens, reads, and closes your text files.
New ones are written into the New subdir.

By installed, I mean unzipped. It's a self extracting zip file. The
program uses an .ini file to remember your preferences and no files
are installed or created outside the program directory.

Very cool!
Thanks much!

-Art-
 
Very cool!
Thanks much!

Certainly. I hate reformatting manually. Let me know how it fits your
needs. It's been up for download for a couple of years now and as many
times as it has been downloaded I've only had a couple of replies. I'm
just curious if it serves a purpose to anyone besides myself.

It cannot pretty up variable width fonts if you use them to view with.
A line with a bunch of w's will be longer than one with a bunch of
i's. Using a non-variable width font will produce very neat results.

You can run it as many times as you like in finding your preferences.
The new files are overwritten each time to the new settings. I like a
4 space margin, a 4 space paragraph indentation and 76 characters per
line, which leaves a 4 space right margin in most editors set for 80
chars per line.
 
Back
Top