- 论坛徽章:
- 0
|
回复 1# vnb2018
情况应该是这样的:
- @2002686 ~
- $ ls
- lsof_4.85 lsof_4.855555 net-tools-1.60.tar.bz2
- lsof_4.85.tar.bz2 net-tools-1.60
- $ ls | grep lsof_4.8555*
- lsof_4.855555
- $ ls | grep lsof_4.*
- $ ls | grep lsof_4.?*
- $ ls | grep lsof_4.85?
- $ ls | grep lsof_4.85?*
- $ ls | grep lsof_4.85.*
- lsof_4.85.tar.bz2
- $ ls | grep lsof_4.8.*
- lsof_4.85
- lsof_4.85.tar.bz2
- lsof_4.855555
- $
复制代码 grep 表达式中*是匹配前面的单个字符0或者多次
man grep
A regular expression may be followed by one of several repetition oper-
ators:
? The preceding item is optional and matched at most once.
* The preceding item will be matched zero or more times.
+ The preceding item will be matched one or more times.
{n} The preceding item is matched exactly n times.
{n,} The preceding item is matched n or more times.
{n,m} The preceding item is matched at least n times, but not more
than m times. |
|