Batch script to replace lines of text - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Batch script to replace lines of text

hitman126hitman126 Posts: 3Member

Can anyone help please?

I would like to create a batch file which replaces not just one word or line in a file, but multiple lines, replacing the removed lines with some specified text. For example, let's just say the lines that appear immediately below has the following entry:

"Hello this is a very complex scenario but I (Line 1)
believe with MS DOS, there is always a way (Line 2)
round the problem. (Line 3)
(Line 4)
Any help on this would be greatly appreciated. (Line 5)
Happy New Year to all forum members." (Line 6)

I now need to replace Line 2, 3 and 4 with my some other text. It is worth pointing out my real-life scenario has a far greater number of lines to be replaced. Can this be down through a batch file?

Thank you.

Sign In or Register to comment.