I have a .html file titlepage.html that contains the following line:
<span class="titlepage modified">Modified: Feb 13, 2020 </span>
The problem is, that sometimes I forget to change the "Modified: " date
I run a .bat file which moves this titlepage.html to the proper location, so I figured it would make sense to add a subroutine in the .bat file to update the date before moving it.
my current .bat file looks like:
@echo off
setlocal enabledelayedexpansion
set infile=titlepage.html
set outfile=result.html
Set find=Modified:
set replace="<span class="titlepage modified">Modified: %DATE% </span>"
del result.html
for /F "tokens=1,2 delims=" %%n in (!infile!) do (
set LINE=%%n
set TMPR=!LINE:%find%=%replace%!
echo !TMPR!>>%outfile%
)
And the line in question of my looks like:
<span class="titlepage modified">"<span class="titlepage modified">Modified: 04/10/20 </span>" Feb 13, 2020 </span>
So it successfully inputs the information I want, but I need it to replace the entire line in question not just the part I used for the lookup.
*Note the dates will be arbitrary so I can't perform a lookup on the entire line.
So I want to: 1. Lookup for a line containing a string 2. Replace that entire line with my new input.
Thanks in advance.