WinMerge:如何在比较中忽略特定单词?
当我在 Windows 平台上使用 WinMerge 比较 2 个文件时,您知道如何忽略特定单词吗?
我的意思是我想对 WinMerge 说:“不要关心那串单词:房子、花园等。”
所以当比较这两行时:
the house is at london
&
the bus is at london
然后将显示无差异,因为我不关心“房子”这个词...
有什么想法吗?
When I compare 2 files with WinMerge on Windows platform, do you know how could I ignore specific words ?
I mean I wanna say to WinMerge : "Don't care about that list of words : house, garden, etc."
An so when comparing those 2 lines :
the house is at london
&
the bus is at london
then no difference will be displayed since I don't care about the word house...
Any idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 winmerge 2.16(至少)(2020-05)中,您可以使用菜单 Plugins >插件设置...
单击PrediffLineFilter.sct,然后单击“插件设置...”按钮,选中相应栏中的“使用正则表达式”复选框。在“查找内容”列中,指定正则表达式并将“替换为”单元格留空。关闭此插件配置窗口。然后,在插件>在 Prediffer 菜单中,选择 PrediffLineFilter.sct。
然后,您可以使用菜单“插件”>“关闭此过滤器插件”普雷迪弗无 Prediffer(正常)。
In winmerge 2.16 (at least) (2020-05), you can use menu Plugins > Plugin Settings...
Click on PrediffLineFilter.sct, then click on the "Plugin Settings..." button, check in "Use RegExp" check box in the corresponding column. In the "Find what" column, specify a regexp and leave the "Replace with" cell empty. Close this plugin configuration window. Then, in the Plugins > Prediffer menu, select PrediffLineFilter.sct.
You can then turn off this filter plugin using menu Plugins > Prediffer > No Prediffer (normal).
我知道自从有人问这个问题以来已经有一段时间了,但是由于在搜索这个主题时这显示为最匹配的内容,我想我应该添加它......
据我所知,WinMerge 仍然没有直接使用此功能。您有 2 个选择:
1) 为 WinMerge 编写自己的插件。如果您愿意投入时间,似乎确实可以以这种方式做您想做的事情。
2) 获取Meld。它包括使用正则表达式忽略行中您不喜欢的部分的功能想要比较。例如,如果您只是将“word”放入文本过滤器首选项中,它将忽略“word”并比较该行的所有其他部分。我用它来比较 Linux 中的 dmesg 日志,忽略开头的计时器字段“^[.*?]”(忽略初始括号之间的所有内容,非贪婪)。
I know its been a while since this was asked, but since this shows up as a top match when searching for this topic, I thought I'd add to it...
As far as I can tell, WinMerge STILL doesn't have this functionality directly. You have 2 options:
1) Write your own plugin for WinMerge. It does seem to be possible to do what you want that way if you wish to invest the time.
2) Get Meld. It includes the ability to use regex to ignore the parts of a line you don't want compared. For example, if you just put "word" in the text filter preferences it will ignore "word" and compare all other parts of the line. I use this to compare dmesg logs in Linux, ignoring the timer field at the start with "^[.*?]" (ignore everything between the initial brackets, non-greedy).
我正在寻找类似的东西,所以这可能对您有帮助:
WinMerge 不允许过滤行的某些部分。如果行过滤器匹配,则忽略整行。有关线路过滤器的说明,请参阅 http://manual.winmerge.org/Filters.html。
因此,如果其中除了“bus”和“house”一词之外还有其他差异,则该行也将被忽略。
I am looking at the moment for something similar, so perhaps this may be helpful for you:
WinMerge does not allow to filter parts of a line. If a line filter matches, the whole line is ignored. See http://manual.winmerge.org/Filters.html for an explanation of line filters.
So if there is a difference other than the word bus and house in it, the line will be ignored as well.