Solved Strip spaces from end of lines w script

May 2, 2011 at 08:28:53
Specs: Windows Vista
Hi Im looking for some help to strip trailing spaces from data file.

exapmle data file has verying text length and varying space length

SOME TEXT space space space space
MORE TEXT ON NEXT LINE space space space space space
NEXT LINE TEXT space space

is it possible to write a dos batch script to remove trailing spaces to end with file as below

SOME TEXT
MORE TEXT ON NEXT LINE
NEXT LINE TEXT

any help appreciated


See More: Strip spaces from end of lines w script

Report •


#1
May 2, 2011 at 09:23:30
✔ Best Answer
:: ==========================================
::
:: endspace.bat Mon 02-05-2011 23:18:09.83
@echo off > newfile & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in (myfile) do (
call :sub1 %%a
>> newfile echo.!S!
)

goto :eof

:sub1
set S=%*
goto :eof


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
May 2, 2011 at 13:26:08
Many thanks works perfectly

Report •

Related Solutions


Ask Question