本文介绍了如何使用find实用程序将文件* .R和* Rd匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到所有以.c.R.Rd结尾的文件.我尝试过

I would like to find all files that end with .c, .R, or .Rd. I tried

find . -iname "*.[cR]" -print

给出所有以.c.R结尾的文件.我还如何另外获取.Rd文件?我知道[]仅匹配一个字符,但是我无法对其进行调整以提供.Rd文件(试图与|或选项-regex等配合使用)

which gives all files that end with .c or .R. How can I additionally get .Rd files as well? I know that [] only matches one character, but I couldn't adjust it to provide .Rd files as well (tried to work with | or option -regex etc.)

推荐答案

在这里==

find -name "*.c" -o -name "*.R" -o -name "*.Rd"

如果只是您要查找的3种扩展名类型,我建议您不要使用正则表达式,而只需使用-o(如或"中的)运算符来组成搜索.

If it's just the 3 extension types that you are looking for, I'd recommend staying away from regex and just using the -o (as in "or") operator to compose your search instead.

这篇关于如何使用find实用程序将文件* .R和* Rd匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 20:38