Path: number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon02.news.prodigy.net!prodigy.net!newsdst02.news.prodigy.net!prodigy.com!postmaster.news.prodigy.com!newssvr27.news.prodigy.net.POSTED!eadf9591!not-for-mail
From: 0@0.0 (FileGod)
Newsgroups: alt.msdos.batch,alt.msdos.batch.nt,fidonet.batpower
Subject: WORDWRAP.BAT
Lines: 48
Message-ID:
NNTP-Posting-Host: 71.142.49.55
27 Mar 2008 05:15:09 EDT)
NNTP-Posting-Date: Thu, 27 Mar 2008 05:15:09 EDT
Organization: SBC http://yahoo.sbc.com
Date: Thu, 27 Mar 2008 09:15:09 GMT
Bytes: 3125
Xref: number1.nntp.dca.giganews.com alt.msdos.batch:93705
alt.msdos.batch.nt:42597 fidonet.batpower:593
Here is a pretty cool batch file someone else wrote, this requires QBasic,
compiler likes Quick Basic, Visual Basic for DOS, Power Basic for DOS can
compile this if all the echos are removed, it is easy to make changes to
this...
-------------------------------------------------------------------------
A batch for wrapping long lines in text files
This is a handy batch file that does a simple thing, fix documents that have
entire paragraphs on one line. Many of the utilities out there simply break
lines at a particular column without regard to words, this batch/QBasic
program only wraps lines between words.
Usage: wordwrap input.txt newfile.txt
The input file should be a normal text file and the output file must be a
different name and valid. CON and PRN work for viewing and printing files
but CON|MORE does not work (batches aren't redirectable).
The wrap position is fixed at column 77, edit the batch to change. It would
be easy to alter the batch to take an extra parm for position, just change
'p=77' to 'p=%3' but don't forget to use it, probably should also change the
initial idiot-checks. I prefer it fixed.
:: WORDWRAP.BAT - by Terry Newton
:: Usage: wordwrap infile.ext outfile.ext
:: Wraps long lines in text files, set to wrap at column 77,
:: change the 'p=77' part to wrap at a different position.
:: Uses QBASIC
@echo off
if .%2==. echo %0 infile outfile
if .%2==. goto end
if not exist %1 echo file not found
if not exist %1 goto end
echo >wwt$.bas :on error goto done
echo>>wwt$.bas open "%1" for input as #1:open "%2" for output as #2
echo>>wwt$.bas loopm:line input #1, a$:if a$="" then print #2,"":goto loopm
echo>>wwt$.bas loop0:p=77:if sgn(p-len(a$)+1)=1 then print #2,a$:goto loopm
echo>>wwt$.bas loop1:if mid$(a$,p,1)=" " then goto cut
echo>>wwt$.bas p=p-1:if p=0 then print #2,a$:goto loopm
echo>>wwt$.bas goto loop1
echo>>wwt$.bas cut:print #2,left$(a$,p-1):a$=right$(a$,len(a$)-p):goto loop0
echo>>wwt$.bas done:close #1:close #2:system
qbasic /run wwt$.bas
del wwt$.bas
:end
|