Increment to text list Add prefix?
Posted: 21 May 2013 19:22
Hello,
I acquired this batch script here on this forum ( from Endoro) which works great!, It increments each line of text, but I'm wondering if its possible to include a prefix before the increment?
Perhaps to add the initials: JP. at the beginning of each line?
Thanks for any help!
Jeff
I acquired this batch script here on this forum ( from Endoro) which works great!, It increments each line of text, but I'm wondering if its possible to include a prefix before the increment?
Perhaps to add the initials: JP. at the beginning of each line?
Thanks for any help!
Jeff
Code: Select all
@echo off &setlocal
set "folder=d:\myfolder"
pushd "%folder%"
set /a cnt=1001
(for /f "delims=" %%i in ('^<"input.txt" findstr /n "^"') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:*:=!"
if defined line (
set "pre=!cnt:~-3!"
echo(!pre!.!line!
endlocal
set /a cnt+=1
) else (
echo(
endlocal
)
))>"output.txt"
popd