背景:我试图通过将其输出汇总到我的根web目录(递归)中获取所有代码文件(.html | .htm | .php | .js | .css)的总行数xargs wc -l | grep total.
$ find . -regex '.+\.php'
./inc/db.php
./inc/userauth.php
./index.php
.......... etc.
$ find . -regex '.+\.js'
./inc/jquery-1.7.1.js
./inc/script.js
$ find . -regex '.+\.(php|js)'
(returns nothing)
Run Code Online (Sandbox Code Playgroud)
根据此,
abc(def|xyz) matches abcdef or abcxyz
Run Code Online (Sandbox Code Playgroud)
所以不应该.+\.(php|js)匹配所有.php文件和.js文件?
find使用不同风格的正则表达式,所以你必须写\(js\|php\)而不是只是(js|php).
| 归档时间: |
|
| 查看次数: |
2938 次 |
| 最近记录: |