1.介绍
字符 | 含义 | 实例 |
---|
* | 匹配0个或多个任意字符 a*b a与b之间可以存在0或多个字符 | ab aabb azsb … |
? | 匹配一个任意字符 a?b,a与b之间必须但也只能存在一个字符,该字符可以是任意字符。 | 例如:aab,abb,acb… |
[list] | 匹配list中的任意单个字符 a[xyz]b,a与b之间必须但也只能存在一个字符,该字符只能是x或y或z。 | 例如:axb,ayb,azb |
[!list] | 匹配除list中的任意单个字符 a[!a-z]b,a与b之间必须但也只能存在一个字符,该字符不能是小写字母。 | 例如:aAb,a0b… |
[c1-c2] | 匹配c1-c2间的任意单个字符 a[0-1]b,a与b之间必须但也只能存在一个字符,该字符只能是数字。 | 例如:a0b,a1b… |
{string1,string2,…} | 匹配string1、string2等中的一个字符串 a{abc,xyz,opq}b,a与b之间必须但也只能存在一个字符串,字符串只能是abc或xyz或opq。 | 例如:aabcb,axyzb,aopqb… |
2. 案列
[root@Centos-root473791 ~]
/etc/asound.conf /etc/gai.conf /etc/libaudit.conf /etc/oddjobd.conf /etc/sos.conf
/etc/autofs_ldap_auth.conf /etc/grub.conf /etc/libuser.conf /etc/pm-utils-hd-apm-restore.conf /etc/sudo.conf
/etc/cas.conf /etc/gssapi_mech.conf /etc/logrotate.conf /etc/prelink.conf /etc/sudo-ldap.conf
/etc/cgconfig.conf /etc/host.conf /etc/ltrace.conf /etc/readahead.conf /etc/sysctl.conf
/etc/cgrules.conf /etc/idmapd.conf /etc/mke2fs.conf /etc/request-key.conf /etc/Trolltech.conf
/etc/cgsnapshot_blacklist.conf /etc/kdump.conf /etc/nfsmount.conf /etc/resolv.conf /etc/updatedb.conf
/etc/dracut.conf /etc/krb5.conf /etc/nsswitch.conf /etc/rsyslog.conf /etc/warnquota.conf
/etc/elinks.conf /etc/latrace.conf /etc/ntp.conf /etc/sestatus.conf /etc/yp.conf
/etc/fprintd.conf /etc/ld.so.conf /etc/numad.conf /etc/smartd.conf /etc/yum.conf
[root@Centos-root473791 ~]
/etc/cas.conf /etc/gai.conf /etc/ntp.conf /etc/sos.conf /etc/yum.conf
[root@Centos-root473791 ~]
[root@Centos-root473791 ~]
file1 file2 file3
[root@Centos-root473791 ~]
file1 file2 file3
[root@Centos-root473791 ~]