小编mai*_*ers的帖子

grep 或 ripgrep:如何仅查找与多个模式匹配的文件(不仅在同一行)?

我正在寻找一种快速方法来查找包含 2 个或更多模式的文件夹中的所有文件

grep -l -e foo -e bar ./* 或者 rg -l -e foo -e bar

显示同一行中包含“foo”和“bar”或不同行中包含“foo”或“bar”的所有文件,但我只想要在不同行中至少有一个“foo”匹配和一个“bar”匹配的文件。仅包含“foo”匹配或仅包含“bar”匹配的文件将被过滤掉。

我知道我可以链接 grep 调用,但这太慢了。

grep ripgrep

18
推荐指数
4
解决办法
1万
查看次数

vim:无法加载库libpython

我没有得到vim使用python支持.我使用以下配置编译vim 7.4.972:

./configure --enable-shared --with-features=huge --enable-multibyte --enable-cscope
    --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-python3interp=yes
    --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=auto
    --enable-gtk2-check --enable-gnome-check --prefix=/home/me/tools/
    --with-global-runtime=/home/me/tools/share/vim/vim74 --with-lua-prefix=/home/me/tools
    --with-luajit --enable-fail-if-missing -with-x | tee vim_conf.log
Run Code Online (Sandbox Code Playgroud)

关于python的输出是:

checking --enable-pythoninterp argument... yes
checking for python2... /sw/python/anaconda/bin/python2
checking Python version... 2.7
checking Python is 2.3 or better... yep
checking Python's install prefix... /sw/python/anaconda
checking Python's execution prefix... /sw/python/anaconda
checking Python's configuration directory... /sw/python/anaconda    /lib/python2.7/config
checking if -pthread should be used... yes
checking if compile and link flags for Python are sane... yes
checking --enable-python3interp …
Run Code Online (Sandbox Code Playgroud)

python vim

6
推荐指数
1
解决办法
2163
查看次数

如何删除特定的子串?

我想知道如果使用perl正则表达式,这个子字符串的出现次数可以是0或更多次,是否可以从字符串中剪切子字符串?

例如:

"foo bar //baz"并且如果它存在的话,它们都"foo bar"应该导致"foo bar"削减双斜线后面的所有东西.

我知道这可以通过其他方法轻松实现,但我很感兴趣,如果正则表达式oneliner是可能的.

我试过($new_string) = ($string =~ /(.*?)(\/\/)*.*/) 但是那不起作用.

regex perl

-4
推荐指数
1
解决办法
71
查看次数

标签 统计

grep ×1

perl ×1

python ×1

regex ×1

ripgrep ×1

vim ×1