Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I've generated a text file, with a specific program, but the problem is I need to run this file against another program, and it doesn't accept empty lines in between text.The program is not able to generate it without empty lines, I tried that.
Question then remains, I have a simple text file, with empty lines. How do I remove the empty lines ?
I do have an sed.exe (non-MKS), but even here I can't get it to work.

I reckon SED.exe can do it, but I'm not certain, and I don't remember hot to use it.
The trick is to replace the ocurrances of (characters in hex values) "DADA" by "DA". D is the Carriage Return character, and A is the Line Feed character. Together, they make the CR/LF pair, which marks a line break. If you have a double line break, you have a blank line.
You can use another utility, SBS2.COM, which is what this batch file does:
===== BATCH SCRIPT BEGIN =====
@echo offif "%1"=="" for %%? in (echo goto:help) do %%? Missing parameter
if not exist %1 for %%? in (echo goto:help) do %%? File not found - %1
goto start
:help
echo SINTAX: %0 targetfile
goto eof:start
:: ASCII assembler by Hebert Kleebauer
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>%TEMP%.\SBS2.COM
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>%TEMP%.\SBS2.COM
echo ?@}IKuNWpe~Fpe?FNHlF?wGMECIQqo{Ox{T?kPv@jeoSeIlRFD@{AyEKj@>>%TEMP%.\SBS2.COM
echo iqe~1NeAyR?mHAG~BGRgB{~H?o~TsdgCYqe?HR~upkpBG?~slJBCyA?@xA>>%TEMP%.\SBS2.COM
echo LZp{xq`Cs?H[C_vHDyB?Hos@QslFA@wQ~~x}viH}`LYNBGyA?@xAB?sUq`>>%TEMP%.\SBS2.COM
echo LRy@PwtCYQEuFK@A~BxPtDss@fFqjVmzD@qBEOEenU?`eHHeBCMs?FExep>>%TEMP%.\SBS2.COM
echo LHsPBGyA?@xAunjzA}EKNs@CA?wQpQpKLBHv?s`WJ`LRCYyIWMJaejCksl>>%TEMP%.\SBS2.COM
echo H[GyFGhHBwHZjjHeoFasuFUJeHeB?OsQH[xeHCPvqFj@oq@eNc?~}Nu??O>>%TEMP%.\SBS2.COM
echo ~oEwoAjBKs?Zp`LBzHQzyEFrAWAG{EFrAqAGYwHTECIQ{coKIsaCsf{Oe~>>%TEMP%.\SBS2.COM
echo CK}Ayre~CNFA{rAyEKFACrA{EKGAjbA}eKGSjNMtQFtc{OAyDGFj?{FDGQ>>%TEMP%.\SBS2.COM
echo KAjNVk_OCAx@e?f{o?CosI}1EGizhljJ~H1ZeG}JBA~rACBMDGjjDG@g0>>%TEMP%.\SBS2.COM:loop
type %1 > %TEMP%.\TEMP.DAT
%TEMP%.\SBS2.COM 0 "$0d$0a$0d$0a" "$0d$0a" < %TEMP%.\TEMP.DAT > %1
if errorlevel=1 goto loopdel %TEMP%.\SBS2.COM
del %TEMP%.\TEMP.DAT
:eof
===== BATCH SCRIPT END =====Watch out for line wrapping!
No external file is needed: the batch file creates SBS2.COM, uses it and deletes it.
The sintax is:
filename.bat targetfile
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

If there are not too many blank lines and you are happy to remove them manually, why not simply use edit or edlin. Usually CNTRL + Y removes the line the cursor is on. Alternatively a word processor will do the job and thenoutput as an ascii file.
Good luck! u

Thanks, I try the script you mention, it looks sort of weird, but if it works, I am more than happy to use it !
Will post if it works or not ...
Anyway, Mike, thanks for the info also, but I need to do it in batch ..

Doesnt seem to work
creates batchfile, but this com file doesnt do anything, creates no output whatsoever

![]() |
dual boot nt and Dos
|
true bootable cd-rom
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |