bacth file to join text

December 13, 2010 at 17:15:34
Specs: Windows XP
Hi, I am trying to create a batch file that reads a text file and if a line of text starts with a '$' then it is added to the previous line (and the original $ line removed). The new lines output to a new file.
i.e.
Oldfile:
my text on a line
$some other text
etc
etc

New file:
my text on a line $some other text
etc
etc

So far I have tried a few combinations such as
::== concat.bat
@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (%1) do (
echo %%a | find "$" > nul
if errorlevel 1 set str1=%%a
if not errorlevel 1 set str2=%%a
echo !str1! !str2! >> %2
)

But I keep getting the original line in the output.


See More: bacth file to join text

Report •

#1
December 13, 2010 at 23:51:49
Programming questions should be posted here:

http://www.computing.net/forum/prog...


Report •
Related Solutions


Ask Question