replace spaces wit a single Tab

April 25, 2011 at 22:40:07
Specs: Windows XP
see below
Input txt:
Mary(space)(space)John(space)Elly(space)Linda
Mary1(space)(space)John1(space)(space)Elly1(space)Linda
Mary2(space)(space)John2(space)(space)Elly2(space)(space)Linda
....................

output.txt:
Mary(tab)John(tab)Elly(tab)Linda
Mary1(tab)John1(tab)Elly1((tab)Linda
Mary2(tab)John2(tab)Elly2(tab)Linda
.........................


See More: replace spaces wit a single Tab

Report •

#1
April 26, 2011 at 02:57:32
:: ==========================================
:: 
:: pankald.bat  Tue 26-04-2011 14:34:40.49
@echo off > newfile & setLocal enableDELAYedeXpansioN

set T=	

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

goto :eof

:sub1

set S=%1
:loop
  if "%2" neq "" (
    set S=!S!!T!%2
    shift
    goto :loop
  )

goto :eof


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

M2


Report •
Related Solutions


Ask Question