1.8.1VIM编辑器
一、VIM文本编辑器
-格式:vim [[目录]文件名]
-若目标文件不存在,则新建空文件并编辑
-若目标文件已经存在,则打开此文件并编辑
二、VIM基本操作
-保存并退出:wq
-放弃修改并退出:q!
1.8.2文本内容过滤
一、根据字符串模式提取文本行
-grep [选项] ‘匹配模式’ 文本文件
1.常用命令选项
-v:取反匹配
-i:忽略大小写
2.用例
[root@localhost03 mnt]# grep root /etc/passwd
[root@localhost03 mnt]# grep -v root /etc/passwd
[root@localhost03 mnt]# grep man /etc/man_db.conf
[root@localhost03 mnt]# grep -i man /etc/man_db.conf
二、常用的匹配模式
-word 包含字符串word
-^word 以字符串word开头
-word$ 以字符串word结尾
[root@localhost03 mnt]# grep ^rooot /etc/passwd //查找以root开头的行
[root@localhost03 mnt]# grep rooot$ /etc/passwd //查找以root结尾的行