1、vim操作:
(1) 应用vi命令在/tmp文件夹下创建文件,文件名newfile。在newfile首行输入日期时间
(2) 将/boot/grub2/grub.cfg文档的内容读入到newfile文档中(在日期的下一行即第2行)
![](https://i-blog.csdnimg.cn/blog_migrate/a2a24d8f6bd78637aff2eb7b167926d5.png)
(3) 查找文档中包含#号字符的行,将整行删除
(4) 开启VI的行号提示功能
![](https://i-blog.csdnimg.cn/blog_migrate/7c5e2add16c0c9e3c72f4ea3cf54bef6.png)
2、文件查看:查看newfile文件的第6行
![](https://i-blog.csdnimg.cn/blog_migrate/5cc8cce7ae26536231b69fc5b2cb7b11.png)
3、查找文件 /usr/share/xml/xml.xsd 中包含字符串 re 的所有行。将所有这些行的副本按原始顺序放在文件/root/files 中
![](https://i-blog.csdnimg.cn/blog_migrate/a2d7e6a0695d356ebc53aabe5ae250e0.png)