Lim*_*eth 2 regex bash shell grep
我正在制作一个bash脚本; 如何找到不以特定扩展名结尾的文件?
#!/bin/bash
find . -type f -print | grep "\.\(?!psd\|xcf\).+$"
Run Code Online (Sandbox Code Playgroud)
谢谢.
您可以使用:
find . -regextype posix-egrep -type f ! -regex '.*\.(psd|xcf)$'
Run Code Online (Sandbox Code Playgroud)
或者没有正则表达式:
find . -type f -not \( -name '*.psd' -o -name '*.xcf' \)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
367 次 |
| 最近记录: |