我在cgywin上遇到了“find”命令的问题。我在这里找到了一个测试文件:
$ find . 'test'
.
./asdftest
./asdftext.txt
./test
./test/asdfastest.txt
./test/test.txt
./test.txt
./textasfa.txt
test
test/asdfastest.txt
test/test.txt
我完全不知道为什么当我这样做时
find . -regex 'test'
我得不到任何结果。我尝试了很多种组合,从来没有运气。这是怎么回事?提前谢谢。
答案 0 :(得分:1)
您需要使用-name
选项:
find . -name '*test*'
使用-regex
选项,以下内容将起作用,因为每个文件名都以./
开头:
find . -regex './.*test.*'
或更准确:
find . -regex '^\./.*test.*'