Unix找到:如何匹配文件* .R和* Rd? [英] Unix find: How to match files *.R and *Rd?

查看:180
本文介绍了Unix找到:如何匹配文件* .R和* Rd?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到所有以 .c .R 或<$ c $结尾的文件C> .Rd 。我试过

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

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

给出所有以<$ c结尾的文件$ c> .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.

这篇关于Unix找到:如何匹配文件* .R和* Rd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆