Solved Conditional searching and adding a string

May 3, 2019 at 11:09:05
Specs: Windows 7
Hello All,

Please help to let me know if is there any fucntion in batch to acheive the below.

I have a huge xml file with 200,000 lines, I want to add a string standalone="no" the first line as below

Before adding the string

<?xml version="1.0" encoding="UTF-8"?>

After adding the string

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

I don't want the program to search for the entire xml file and replace, is there any way can we limit the search to first 2 lines and add the string standalone="no"


Regards,
Sandra


See More: Conditional searching and adding a string

Reply ↓  Report •

#1
May 4, 2019 at 16:35:36
✔ Best Answer
use findstrir /1/ <?xml version="1.0" encoding="UTF-8"?> ~<?xml version="1.0" encoding="UTF-8" standalone="no"?>

Reply ↓  Report •
Related Solutions


Ask Question