On 12/30/2011 2:30 PM, meve wrote:
> On Dec 30, 12:32 am, Todd Vargo<tlva...@sbcglobal.netz> wrote:
>> On 12/29/2011 5:42 PM, meve wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> Help !
>>
>>> I am attempting to create a batch file that will insert the character
>>> 2 into position 118 of a text file.
>>> the 1st line is what is getting generated. I need to have the batch
>>> file run to insert the character 2 into position 118
>>> the 2nd line is what i'm looking for the end result.
>>
>>> the spaces between 0 (space #70)& 2 (space #118)
>>
>>> 888888 **
>>> -0001.30
>>> 888888 **
>>> -0001.30 2
>>
>>> any help would be very much appreciated.
>>
>> Does this batch do what you want?
>>
>> @echo off&setlocal enabledelayedexpansion
>> set "line= "=20 spaces
>> for /f "delims=" %%a in (input.txt) do (
>> set "line=%%a!line!!line!!line!!line!!line!!line!"
>> echo !line:~0,117!2
>> )>output.txt
>
> That worked Todd ! Thank you very much.. now can I apply that to all
> of the lines in the text file. This file will only contain the lines
> that need to have the 2 in position 118.
>
> Hope i'm describing what I need now, after you were able to get the
> initial issue figured out for me.
It needs this modification to do that.
@echo off&setlocal enabledelayedexpansion
set "pad= "=20 spaces
for /f "delims=" %%a in (input.txt) do (
set "line=%%a!pad!!pad!!pad!!pad!!pad!!pad!"