Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello again,
I have another misery here how to solve via batch file command. I have this text file that contains with space tab delimiters
i.e.
Apple<space tab>Orange<space tab>Kiwiresults:
Apple | Orange | KiwiIt should detect all the <space tab> no matter how long the columns will be and replaced by |
Is that possible?
Thanks in advanced!
-Lee-

No idea about <space tab> [sic] but for a TAB, 09hex, delimited try this:
===============================
@echo off > newfile & setLocal enableDELAYedexpansion for /f "tokens=* delims= " %%a in (my.txt) do ( set S=%%a set S=!S: =^|! >> newfile echo !S! )
=====================================
Helping others achieve escape felicityM2

use a good tool for string parsing. if you can download gawk for windows
c:\test> gawk "BEGIN{OFS=\"|\"}{$1=$1}1" file

Thanks again Mech but it didn't work on my end withy your sample. I dont have the results when I try to run it. No Error or file 'newfile' created.

Try this line by itself. If you don't get a NEWFILE then I have no clue.
@echo off > newfile & setLocal enableDELAYedexpansion
=====================================
Helping others achieve escape felicityM2

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |