1.

Solve : Help with Batch files plz?

Answer»

I searched this sight and I could not find my answer I don't even KNOW if this is possable

I am a cad user that that has 1 folder that has 100 or so files with MISC names but all have a *.tpl ending and they are structed like this ex. below There is nothing else in this folder but the tpl files i NEED edited. It is always 6lines down where the editing needs to start if that matters.

Some of these files have 30-40 entries.
Well I need to delete the S: that is evey file.
Can anyone help me with bat file I can stick in this directory and it will go thru all my files and delete that string?


DataCAD template file. version 01.10.

1
6
*
S:\LEGEND\WOODRAIL\R1
S:\LEGEND\WOODRAIL\R2
S:\LEGEND\WOODRAIL\R3
S:\LEGEND\WOODRAIL\R4
S:\LEGEND\WOODRAIL\R5
S:\LEGEND\WOODRAIL\R6

Thanks Chance

I am not sure what you are trying to do. If they are text files, open them up and most word processors will have a replace feature. Simply enter S: in the search box and leave the replace box empty and it should delete each instance of S:Try a batch file like this:

Code: [Select]@echo off

for %%i in (*.tpl) do (
echo processing %%i ...
if exist %%i.tmp del %%i.tmp
for /f "delims=: tokens=1*" %%j in (%%i) do (
if "%%j"=="S" (
echo %%k >> %%i.tmp
) else (
echo %%j%%k >> %%i.tmp
)
)
del %%i
move %%i.tmp %%i
)

Cheers,
[glb]cs[/glb]Neil. Yes I have used the replace comand. it takes QUITE awhile to open 100 files indvidual and Paste the S: in one field and replace all then CLOSE. I wish word would replace all, in different files. I felt like i was getting carpel tunnel.

cs ty very much, I will play with it.



Discussion

No Comment Found