![]() |
Web Development »
Applications & Tools »
Tools with source code
Intermediate
License: The zlib/libpng License
WinTextFilePatchBy KochiseA super search and replace tool |
VC6Win2K, WinXP, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

Many times, I was involved in sorting my Opera (fantastic web browser, for whose don't knot it) cache, keeping in a safe place some HTML file, deleting some other useless. In the kept files, I often had to search for URL and retrieve the file associated. It was a huge task, even if Opera can nicely manage download. So I create HTML files with all the URL, then use a web grabber to retrieve them in background.
But the task to compile all files, look for all the URL, creating a single HTML still have to be done by hand. So I created this little tool to look for a specific pattern in a set of files and output multiple or an unique file with the URL. It was then too much easy to compile stuffs ;)
<span class="imagelink">
http://galleries.amberlace.com/ndnikki1/pics/01.jpg:
<br /><img src="http://galleries.amberlace.com/ndnikki1/pics/01.jpg">
<br clear=all><BR><BR><BR>
<span class="imagelink">
http://galleries.amberlace.com/ndnikki1/pics/02.jpg:
<br /><img src="http://galleries.amberlace.com/ndnikki1/pics/02.jpg">
<br clear=all><BR><BR><BR>
<span class="imagelink">
http://galleries.amberlace.com/ndnikki1/pics/03.jpg:
<br /><img src="http://galleries.amberlace.com/ndnikki1/pics/03.jpg">
<br clear=all><BR><BR><BR>
<span class="imagelink">
http://galleries.amberlace.com/ndnikki1/pics/04.jpg:
<br /><img src="http://galleries.amberlace.com/ndnikki1/pics/04.jpg">
<br clear=all><BR><BR><BR>
...
Now you wants to save them cleanely in the same file without the mess and the ads, or compile every URL you may find in a big file, in order to get this :
<a href="http://galleries.amberlace.com/ndnikki4/pics/1.jpg">
http://galleries.amberlace.com/ndnikki1/pics/1.jpg</a><br>
<a href="http://galleries.amberlace.com/ndnikki1/pics/2.jpg">
http://galleries.amberlace.com/ndnikki1/pics/2.jpg</a><br>
<a href="http://galleries.amberlace.com/ndnikki1/pics/3.jpg">
http://galleries.amberlace.com/ndnikki1/pics/3.jpg</a><br>
<a href="http://galleries.amberlace.com/ndnikki1/pics/4.jpg">
http://galleries.amberlace.com/ndnikki1/pics/4.jpg</a><br>
...
Here the explanation step-by-step, section-per-section :
Source : Source folder that contains the files. Currently no sub-directory support.
Extension : File extension to process, separated with a semi-column. If empty, process every file of the source folder.
Destination : Destination folder, where the modified files have to be written. If the path ends with a filename, things extracted will be written inside a unique file.
Start : The beginning of the text to look for. In the previous example/pattern, it would be
<span class="imagelink">
Body : Name the body part you wan to keep safe and write in the destination file. Leave it to body if you want, it's not such important...
End : The end of the text that will encapsulate the body. From the previous example, it would be after the interresting URL, such
:<br /><img src=
Replace : Put here the replacement line including the retrieved body. To include the body, just write the body name with a percent sign before. Hence, to create a valid URL, write
<a href=\"%body\">%body</a><br>
Include unprocessed text : Include in the output file the text found before the start and after the end of what have to be processed. Hence you may just modify/clean a file ;)
Add end of line : Add an end-of-line after each match. Useful to create one line per URL.
Header : Header of the new file.
Tail : Tail of the new file.
!!! : Let's GO !
None yet ;)
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 24 Mar 2004 Editor: Nishant Sivakumar |
Copyright 2004 by Kochise Everything else Copyright © CodeProject, 1999-2009 Web22 | Advertise on the Code Project |