2.5.8 正则表达式的贪婪性
有多少要多少,尽可能多的匹配。
2.5.9 .* 表示所有
显示所有的内容,一次找到。
[root@znix ~]# grep -o ".*" oldboy.txt I am oldboy teacher! I teach linux. I like badminton ball ,billiard ball and chinese chess! my blog is http://oldboy.blog.51cto.com our site is http://www.etiantian.org my qq num is 49000448. not 4900000448. my god ,i am not oldbey,but OLDBOY!
表示所有.* 连续出现的时候会表现贪婪性。
[root@znix ~]# grep "^.*m" oldboy.txt I am oldboy teacher! I like badminton ball ,billiard ball and chinese chess! my blog is http://oldboy.blog.51cto.com my qq num is 49000448. my god ,i am not oldbey,but OLDBOY!
2.5.10 [abc] 中括号表示一个整体
相当于一个符号,表示a或者b或者c。
[root@znix ~]# grep "[0-9]" oldboy.txt [root@znix ~]# grep "[A-Z]" oldboy.txt [root@znix ~]# grep "[a-z]" oldboy.txt
找到文本中的大写和小写字母。
[root@znix ~]# grep "[a-zA-Z]" oldboy.txt
2.5.11 找以 m或n或o开头的 并且以 m或g 结尾的行
.* 表是什么都可以
^[mno] m 或n或o开头的
[mg]$ m 或g 结尾
[root@znix ~]# grep "^[mno].*[mg]$" oldboy.txt my blog is http://oldboy.blog.51cto.com our site is http://www.etiantian.org
2.5.12 [^abc] 排除a或排除b或排除c
[^abc] 表示找排除a或排除b或排除c之外的其他字符 [root@znix ~]# grep "[^abc]" oldboy.txt I am oldboy teacher! I teach linux. I like badminton ball ,billiard ball and chinese chess! my blog is http://oldboy.blog.51cto.com our site is http://www.etiantian.org my qq num is 49000448. not 4900000448. my god ,i am not oldbey,but OLDBOY! 2.5.13 grep -v 排除与[^abc] grep -v 排除行 [^abc] 字符或文字
第3章 昨日回顾(删除文件、开机自启动)
3.1 linux如何让一个服务/脚本开机自启动?
1)chkconfig
2)/etc/rc.local
3.1.1 被chkconfig管理 需要什么条件
1)必须放在/etc/init.d/
2)这个脚本要有执行权限
3)加上chkconfig要求的内容
# chkconfig: 2345 99 99
4)chkconfig --add 把脚本添加到开机自启动
5)检查
3.2 /etc/rc.local
[root@znix ~]# ls -l /etc/rc3.d/ |grep rc.local lrwxrwxrwx. 1 root root 11 Aug 10 18:36 S99local -> ../rc.local
3.3 磁盘空间不足 no space left on device
1)block满了 500G 3*200G视频
df -h du -sh /* du -sh /* |grep G
2)block满了 文件没有被彻底删除 硬链接数为0,进程调用数不为零
检查:lsof|grep delete
3.4 文件的删除原理(条件)
1、硬链接数为0










