[译]WinTextFilePatch
By robot-v1.0
本文链接 https://www.kyfws.com/applications/wintextfilepatch-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 4 分钟阅读 - 1816 个词 阅读量 0[译]WinTextFilePatch
原文地址:https://www.codeproject.com/Articles/6493/WinTextFilePatch
原文作者:Kochise
译文由本站 robot-v1.0 翻译
前言
A super search and replace tool
超级搜索和替换工具
介绍(Introduction)
很多时候,我参与了对Opera(奇妙的网络浏览器,不打结的)浏览器进行排序的工作,将一些HTML文件保存在安全的位置,并删除了其他无用的文件.在保存的文件中,我经常不得不搜索URL并检索关联的文件.即使Opera能很好地管理下载,这也是一项艰巨的任务.因此,我将使用所有URL创建HTML文件,然后使用网络抓取程序在后台检索它们.(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.)
但是,编译所有文件,查找所有URL,创建单个HTML的任务仍然必须手动完成.因此,我创建了这个小工具,用于在一组文件中查找特定模式,并输出多个或唯一的URL文件.那时,编译东西太容易了;)(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 ;))
特征(Features)
使用工具(Using the tool)
<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>
...
现在,您想要将它们干净地保存在同一文件中,而不会造成混乱和广告,或者将您可能在大文件中找到的每个URL编译,以获取此信息:(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>
...
文件(File)
资源(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.)
文本(Text)
开始(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):在每次比赛之后添加一个行尾.对于每个URL创建一行非常有用.(: Add an end-of-line after each match. Useful to create one line per URL.)
封装形式(Encapsulation)
标头(Header):新文件的标题.(: Header of the new file.)
尾巴(Tail):新文件的尾部.(: Tail of the new file.)
处理(Process)
!!!(!!!): 我们走吧 !(: Let’s GO !)
历史(History)
还没有 ;)(None yet ;))
免责声明(Disclaimer)
- 首先,该工具不兼容Unicode.它只处理单字节字符集.(First the tool IS NOT Unicode compliant. It just process single byte charset.)
- 其次,对那些为我提供的链接感到震惊的白痴感到抱歉.这很可爱;)(Second, sorry for the morons who will be shocked by the links I gave as example. It’s just cute ;))
- 第三,按原样提供.我会故意进行升级.但是请随意修改该工具以供您自己使用.(Third, this is provided as is. I’ll make upgrades on purpose. But feel free to modify the tool for your own usage.)
- 第四,此工具比您甚至预期的要有用得多.它也缺少配置保存,以便重新设置参数集来处理另一堆文件.(Fourth, this tool is far more useful than you even expected. It lacks also of a configuration saving, in order to set back a parameter set to process another bunch of files.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 WinXP Windows Win2K Visual-Studio Dev 新闻 翻译