cha*_*ion 0 linux console perl
我想使用perl regexp grep文件中的文本,我这样做
find ./ -name *.php -print | xargs perl -nle '/standard/ and print $0'
Run Code Online (Sandbox Code Playgroud)
正如我在$ 0中发现(使用谷歌)必须是已执行脚本的名称,但它包含"-e".我怎样才能获得执行脚本名称?
程序员用ack替换long find/grep命令行.它使用Perl正则表达式,它比GNU grep更先进-P(PCRE)或任何正则表达式的POSIX grep使用的gimped实现.
ack --php -l '(?<!\$)standard'
Run Code Online (Sandbox Code Playgroud)
-l仅打印匹配的文件名.