S
S
Sergey Krylov2018-08-10 03:33:39
cmd/bat
Sergey Krylov, 2018-08-10 03:33:39

Do you need to replace text in a large file using vbs or bat how?

Hello, I'm trying to organize a search to replace a piece of text in a large file.
Found the code online

Const ForReading = 1 
Const ForWriting = 2 

Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objFile = objFSO.OpenTextFile("C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\bin\win64\client.dll", ForReading) 

strText = objFile.ReadAll 
objFile.Close 
strNewText = Replace(strText, "1134", "1401") 

Set objFile = objFSO.OpenTextFile("C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\bin\win64\client.dll", ForWriting) 
objFile.WriteLine strNewText 
objFile.Close

I'm trying to do something that would automatically find the desired text and replace it with the one I need, for example, there are 1134 in the file and I need to replace all these values ​​with 1401. Again, everything is not so simple, you need to change it 1 time.
Or even change all "1134" values ​​to "1401" which is between dota_camera_pitch_max and dota_camera_distance.
Who is not afraid, here is the file itself over which I am suffering. https://yadi.sk/d/q-nkzoD_3a692L

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Yaroshevich, 2018-08-16
@YMax

As an option - use sed - there is also for Windows, a post on habré , a list of commands .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question