Hi guys,
I'm trying to create a batch file that removes certain text from htm files.
I want to remove certain html tags (like red highlights) and delete strike-through text (which is between < s > and < /s > tags).
I have several folders containing these html files. Just want to drag and drop the multiple files on the .bat The batch file should replace the original file with the modified one.type 1.htm | find /v "< s >" | find /v "< /s >" > 2.htm
didn't work for me. It deletes the complete line in 2.htm and not just the text within < s > and < /s >
F1 please
< and > are redirection characters, you need to escape them with a caret (^< s ^>). Can I put a question here?
@Matt123, that's not what the problem is, the < and > are ok because they are enclosed in quotes and so they don't get treated as redirection characters. The problem is you are trying to delete a substring from within a line. Batch is not very good at doing that. You may find it easier to write it in VBScript, or use a helper utility such as sed (available from GnuWin32).
Also, you are assuming all your text within the < s > and < /s > is on the same line. Is that a valid assumption? In html, it is allowed to span any number of lines.
FIND did what you told it to. It is a line based util. So is FINDSTR. Batch is not well suited to rpocessing html. Even on it's best behavior it will probably mangle the indenting.
=====================================
Life is too important to be taken seriously.M2
Thanks for the tip klint. Can I put a question here?
Thanks for your responses.
Klint, I'll try VBScript. It's a good suggestion.
And yes, my text in < s > and < /s > spans several line.
I'll try VBScrips on Monday and will let you guys know.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |