1.

Solve : In need of a batch file to remove position in text file?

Answer»

I need a batch file that will delete position 805 in every row of a text file.  Any help would be appreciated!Could you please be a bit more clear? Do you mean you want to read a text file, line by line, and delete the 805th character of each line? That is, the new line will be characters 1 to 804, and then characters 806 to the end?
YES - start with report1.txt.....have the batch file copy it to another file (report2) with the 805th character removed.  Thanks for the RESPONSE!! :-)try this, it should work as LONG as report1.txt does not contain any poison characters-

Code: [Select]echo off
setlocal enabledelayedexpansion
REM batch strings are INDEXED starting at 0
REM first part starts at character index 0
REM and is 804 characters long
set firstpartlength=804
REM last part starts at character index 805 (the 806th char)
set lastpartstart=805
if exist report2.txt del report2.txt
for /f "delims=" %%A in (report1.txt) do (
set STRING1=%%A
echo !string1:~0,%firstpartlength%!!string1:~%lastpartstart%! >> report2.txt
)
Salmon Trout - This worked perfectly....thank you so much for your help!!!



Discussion

No Comment Found