I have a Html File my.html that have links like that:
<a href="1.html">1.html</a>
How can i make batch script (for windows,BAT file) that each time a new Html file added to the folder the my.html add new line, for example after adding test.html:
<a href="test.html">test.html</a><br/>
Sed1 is perfect for such things. You can do:
Short explanation:
The Sed command looks like this:
s#search_string#replace string#gstells Sed to search and replace#is the delimiter for the Sed command (any character can be used for that)."<a href=.*>.*</a>"(i.e. any string that starts with
<a href=followed by>, and ends with</a>).The pattern is enclosed in escaped parentheses, i.e.
\(pattern\). That allows Sed to remember the occurence of the string that mathces this pattern as\1.\1<br/>, i.e. the search string is replaced by itself with<br/>appended at the end.gtells Sed to repeat that for all occurrences of the search string in the file.Hope that helps!
1 Sed has also been ported for Windows (see here).