Tom's Guide | Tom's Hardware | Tom's Games | PC Safety Suite
![]() |
![]() |
![]() |
Comment:
I'd like to replace string with new one in *.srt file.
I found similar solution created by M2 here:http://www.computing.net/answers/pr...
----------------------------------------------------
@echo off > newfile
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (oldfile) do (
set str=%%a
set str=!str:oldtext=newtext!
echo !str! >> newfile
)
-----------------------------------------------------
Is it possible:
1. to make upper solution case sensitive,
2. to read from file a list of strings which need to be replaced at once,
instead of replaceing strings one by one, and
3. in case that in "oldfile" exist more than one same string, just to find the first and replace with new one (the others except the first one have to be left unchanged).Thanks in advance.
+1 | ![]() |
1. yes, i think it's possible using find.exe, but it will impact on the performance severely when replacing string in large file.
2. use for loop in list of strings
eg.
set list=this is a list of strings
for /f "tokens=*" %%a in (file.txt) do (
set str=%%a
for %%b in (%list%) do set str=!str:%%b=!
)3. use goto:breakAloop when match found
i would suggest using vbscript that support case sensitive replace function.
vbBinaryCompare 0 Perform a binary comparison.
vbTextCompare 1 Perform a textual comparison.
+1 | ![]() |
First off all, my apology about my voute in which I said that your answer is the best, the corect is that it is the worst answer I've ever got!
Everyting in your answer is wrong!!!
Why are you dealing with something that you understand less than me?
+1 | ![]() |
I am asking for help only those people who can help.
I don't need so-called help. If you can help, then help, but don't take with your "suggestions" place those pearsons who can know to give real answer.
So if I ask: "Is it possible to make upper solution case sensitive?", do you think that your answer: "Yes, i think it's possible using find.exe..." is really what I expected?
Maybe, here is someone really f**... d**..., but I'm absolutely sure that guy is not me!
+1 | ![]() |
think carefully, the dumb guy is you.
if you had reply nicely, i'll write and show you the whole working script either in batch or vbs.oops, or you brain is too dumb to think.
+1 | ![]() |
It is obviously that this is left out of the normal communication.
You're very conceited pearson who hardly tolerate criticism.
Think, If I ask someone a piece of bread, and he tells me that I
can buy it in the bakery, can we say that he helped me?
I think, he not!
Or maybe you really think that I do not know where to buy a bread?I know exactly what, but I do not know how, because my knowledge in programming is very poor and that is the main reason why I need help.
===================================================
Now, I think that is enough of this kind of conversation.
I do this all for hobbies and fun, and this certainly is not more fun.
===================================================
+1 | ![]() |
First off all, my apology about my voute in which I said that your answer is the best, the corect is that it is the worst answer I've ever got!
Everyting in your answer is wrong!!!
Why are you dealing with something that you understand less than me?
this ain't criticism, remember, me and the others are here to help on voluntary basis. i perfectly know what i am suggesting and how to implement it.I know exactly what, but I do not know how, because my knowledge in programming is very poor and that is the main reason why I need help.
then DON'T be such a cocky a*** h*** when asking for help.Now, I think that is enough of this kind of conversation.
I do this all for hobbies and fun, and this certainly is not more fun.
if you can't stand it, then DO NOT start mental harashment in the first place. and think again the consequenses before you speak.
+1 | ![]() |
I almost forgot, have you seen that movie, "Dumb & Dumber"
if you didn't - look at it, if you're - look at it again!
Maybe looking at that film will help you to calm down.
Keeping your nerves down, will help you to live longer.
![]() |
vbs/html yahoo finance st...
|
batch to move files with ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.