【发布时间】:2018-02-12 03:51:54
【问题描述】:
我正在使用 Notepad++ 的“在文件中查找”(Ctrl +Shift +F) 功能来搜索文本文件中出现的字符串。 我的文本文件 (.sql) 位于目录的子文件夹中(例如下面的“Views”和“MaterializedViews”):
C:\users\Schema Export\schema_name\Views
C:\users\Schema Export\schema_name\ MaterializedViews
例如,单击“cust_account”的“全部查找”(在目录中:“C:\users\Schema Export\schema_name\”)会在记事本的“查找结果”屏幕中显示:
C:\users\Schema Export\schema_name\Views\SM.sql (2 hits)
C:\users\Schema Export\schema_name>\Views \V_ACCOUNT.sql (8 hits)
C:\users\Schema Export\schema_name\Views \V_ACCOUNT_rework.sql (8 hits)
例如,对“pos_row_id”的新搜索给了我:
C:\users\Schema Export\schema_name\Views\V_ACCOUNT.sql (2 hits)
C:\users\Schema Export\schema_name\Views\V_ACCOUNT_rework.sql (2 hits)
C:\users\Schema Export\schema_name\Views\V_HUB_REFER.sql (1 hit)
在折叠模式下,我现在在搜索窗口中看到两行:
Search "pos_row_id" (5 hits in 3 files)
Search "cust_account" (22 hits in 4 files)
我想自动执行此搜索,以便一次性完成以下操作:
Search value1 (x1 hits in y1 files), where value1 is "pos_row_id" in example above,
Search value2 (x2 hits in y2 files), where value2 is "cust_account" in example above,
Search value3 (x3 hits in y3 files), etc.
Search value4 (x4 hits in y4 files)
Search value5 (x5 hits in y5 files)
Search value6 (x6 hits in y6 files)
(..)
我的第一个想法是记录一个宏并更新它(使用我的不同值、value1、value2 等从现有复制代码)
不幸的是,“shortcuts.xml”文件中没有生成宏代码(这个主题有很多线程......)
是否有任何其他可能性(可能使用 python 脚本)从上面描述的所有搜索结果的值列表中一次性检索?
谢谢!
【问题讨论】:
-
如果您不确定如何提问/评论,您应该查看Help Center(我看到您试图编辑我的帖子以通知我进行澄清)。我会更新我的答案,但如果您有什么要问的,请下次发表评论而不是编辑。
-
您可能会遇到语法错误,因为您没有运行最后一个 python 版本(我在答案中已指定)。