- 论坛徽章:
- 84
|
[0-9]* 0个或多个,只匹配0个。
[0-9]\+ 1个或多个,却匹配多个。
[root@test9 root]# echo sdgasdg124asdf | grep -o '[0-9]*'
[root@test9 root]# echo sdgasdg124asdf | grep -o '[0-9]\+'
124
[root@test9 root]# echo sdgasdg124asdf | grep -o '[0-9]*'
[root@test9 root]# grep --version
grep (GNU grep) 2.5.1
Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[ 本帖最后由 yjh777 于 2006-12-5 17:58 编辑 ] |
|