看看那些正则表达式
find /tmp/MG/virt-manager-5.0.0/ -maxdepth 1 -type f |grep -v [^a-z]+\.[^a-z]+
/tmp/MG/virt-manager-5.0.0/.mailmap
/tmp/MG/virt-manager-5.0.0/virt-manager
/tmp/MG/virt-manager-5.0.0/DESIGN.md
/tmp/MG/virt-manager-5.0.0/meson.build
/tmp/MG/virt-manager-5.0.0/NEWS.md
/tmp/MG/virt-manager-5.0.0/.gitignore
/tmp/MG/virt-manager-5.0.0/README.md
/tmp/MG/virt-manager-5.0.0/.pylintrc
/tmp/MG/virt-manager-5.0.0/.coveragerc
/tmp/MG/virt-manager-5.0.0/virt-install
/tmp/MG/virt-manager-5.0.0/.packit.yaml
/tmp/MG/virt-manager-5.0.0/COPYING
/tmp/MG/virt-manager-5.0.0/virt-xml
/tmp/MG/virt-manager-5.0.0/virt-manager.spec.in
/tmp/MG/virt-manager-5.0.0/INSTALL.md
/tmp/MG/virt-manager-5.0.0/meson_options.txt
/tmp/MG/virt-manager-5.0.0/virt-manager.spec
/tmp/MG/virt-manager-5.0.0/virt-clone
/tmp/MG/virt-manager-5.0.0/CONTRIBUTING.md
/tmp/MG/virt-manager-5.0.0/setup.cfg
我想获取包含大写字母的字符串,包括 .md .txt 但前提是单词至少包含一个大写字母,以便更好地解释
CONTRIBUTING.MD OK
CONTRIBUTING.txt OK
CONTRIBUTING.TXT OK
Contributing.txt OK (has one capital letter)
contributing.txt NO (only lowercase)
我想得到这个
find /tmp/MG/virt-manager-5.0.0/ -maxdepth 1 -type f |grep -v REGEXWORKS
/tmp/MG/virt-manager-5.0.0/DESIGN.md
/tmp/MG/virt-manager-5.0.0/NEWS.md
/tmp/MG/virt-manager-5.0.0/README.md
/tmp/MG/virt-manager-5.0.0/COPYING
/tmp/MG/virt-manager-5.0.0/INSTALL.md
/tmp/MG/virt-manager-5.0.0/CONTRIBUTING.md
怎么办?谢谢
就像这样:
$ find . -type f -name '*[A-Z]*'
./virt-manager-5.0.0/COPYING
./virt-manager-5.0.0/NEWS.md
./virt-manager-5.0.0/INSTALL.md
./virt-manager-5.0.0/README.md
./virt-manager-5.0.0/CONTRIBUTING.md
./virt-manager-5.0.0/DESIGN.md