I am trying to write a windows batch script that it will search until
Example:
example1
example2
example3
example4
<jar href="example.jar" main="true"/>
So i want to replace first part until ( <jar href )
of the text with another text.
I mean the first the first 4 lines will be replaces with another text.
Is there any find until and replace method in batch script.
You can do it but editing XML it isn't very easy using DOS, and in order to make it happen, you are going to first need to start your batch file like this:
Then, you will need to understand how you can escape the '<' and '>' chars with delayed expansion using the '^' character.
I would recommend you also review the website called DosTips .
Finally, I wrote a script that edits property files, which is an example that you might be able to pull some ideas from.
Finally, if what you are editing is pure XML, you might have some success with XML Starlet in dos script.
Your specific scenario is fairly easy to implement in batch. I'm assuming you want to preserve the entire line that contains
<jar href
You don't say where the replacement text is coming from. I'm assuming it comes from another file.