开发者

Text editor that searches within search results

Does anyone know of a text editor that searches within search results using regex?

I would like to perform a regex search on several text files and get a list of matches and then apply another regex search on the search results to further narrow down results. I would prefer a Windows GUI editor rather than a specialized edito开发者_C百科r with a steeper learning curve like Vim or Emacs.


You might want to look at PowerGrep. It's not exactly a text editor, but you can open files containing your search results within its built-in text editor, and edit stuff there.

The main thing though is that it allows you to search using a regex (or list of regexes), then apply an additional regex to each search result, before returning a 'final' result, which I believe is what you are asking for. Kind of hard to explain, but maybe you get the idea.

The only problem with PowerGrep is that its UI is not very good. To say it takes some getting used to is an understatement. But once you figure it out, you can do a lot of powerful stuff (search/replace, data collection, etc on multiple files whose file names can also be regexes).

The companion product EditPadPro by the same company is also a great editor that has a really good regex engine built-in (probably the same one as in PowerGrep), but it doesn't allow you to do the 'regex-applied-to-a-regex-result' that I think you are asking for.


Do you want list of files in which text matches both reg.exps or a list of lines?

In the first case you can do :

{ grep -l -R 'pattern1' * ; grep -l -R 'pattern2' * } | sort | uniq -d

Note that with Windows you can get those binaries from GnuWin32 and use nearly the same syntax in a batch file:

( grep -l -R "pattern1" *
  grep -l -R "pattern2" *
) | sort | uniq -d

In the last case you can with vim use my answer to narrow quickfix results with reg.exp.

Of course you can also copy your search results to a buffer and do some linewise filtering.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜