I have text file that looks like this:
***** HOST NAME: *****
HX-2UA0410KKK
***** LOGMEIN ID: *****
HostDescription REG_SZ store-49877
***** PORTAL CLIENT GUID: *****
f7bca0bf-08e0-4095-89f4-00620d123456
***** GEO HEALTH: *****
[Multicam]
HSchedule=0
UseSoftWatchDog=1
exepath=C:\DTT3330\DM500Startup.exe
SWDogActive=(2011- 8- 9 3: 2:59)
I need it to look like:
***** HOST NAME: *****, HX-2UA0410C3J,***** LOGMEIN ID: *****, HostDescription REG_SZ store-49877, ***** PORTAL CLIENT GUID: *****, f7bca0bf-08e0-4095-89f4-00620da48a60, and so on...
I think you get the picture.
Any assistance would be create is you could recommend a program that can modify multiple texts files or a way to script this using a batch. Thank you!
text file with multiple rows to 1 row tab delimited or comma
Moderator: DosItHelp
Re: text file with multiple rows to 1 row tab delimited or c
The key trick is to output text without issuing a newline:
Unfortunately I'm not aware of a way to preserve leading spaces.
Complete solution if you don't care about preserving empty lines:
If you want to preserve empty lines as empty fields:
Dave Benham
Code: Select all
<nul set /p = This will "echo" without a new line but leading spaces are stripped.
Complete solution if you don't care about preserving empty lines:
Code: Select all
@echo off
setlocal
set infile="test.bat"
set outfile="test.out"
if exist %outfile% del %outfile%
for /f "usebackq tokens=* eol= delims= " %%a in (%infile%) do <nul set/p=%%a,>>%outfile%
If you want to preserve empty lines as empty fields:
Code: Select all
@echo off
setlocal
set infile="input.txt"
set outfile="test2.out"
if exist %outfile% del %outfile%
for /f "skip=2 delims=" %%a in ('find /v /n "" %infile%') do (
set ln=%%a
setlocal enableDelayedExpansion
<nul set/p=!ln:*]=!,>>%outfile%
endlocal
)
Dave Benham