当前用户(shiyanlou)家目录下的04目录下有一个名为messages的系统日志文件,请您在其中找到和软件更新yum相关的日志提取其中的日期、时间和信息字段,并存储到当前用户(shiyanlou)家目录下的yum_messages文件中,messages样例如下: Mar 30 16:33:30 localhost yum[32835]: Installed: apr-1.4.8-3.el7_4.1.x86_64 Mar 30 16:33:30 localhost yum[32835]: Installed: apr-util-1.5.2-6.el7.x86_64 Mar 30 16:33:31 localhost yum[32835]: Installed: httpd-tools-2.4.6-67.el7.centos.6.x86_64 Mar 30 16:33:31 localhost yum[32835]: Installed: mailcap-2.1.41-2.el7.noarch copy 提取后应为: Mar 30 16:33:30 Installed: apr-1.4.8-3.el7_4.1.x86_64 Mar 30 16:33:30 Installed: apr-util-1.5.2-6.el7.x86_64 Mar 30 16:33:31 Installed: httpd-tools-2.4.6-67.el7.centos.6.x86_64 Mar 30 16:33:31 Installed: mailcap-2.1.41-2.el7.noarch copy 当前用户(shiyanlou)家目录下的04目录下有一个名为sshd_config的SSH服务器配置文件,请您去除该文件中的所有空行和注释行(由"#"字符打头的行),并将结果保存在当前用户(shiyanlou)家目录下的sshd_config.bak文件中(提示:此处将用到一些正则表达式的知识)。
时间: 2024-01-22 20:19:16 浏览: 150
提取yum信息的命令如下:
```bash
grep "Installed:" ~/04/messages | sed 's/localhost yum\[[0-9]*\]: //' > ~/yum_messages
```
去除空行和注释行的命令如下:
```bash
sed '/^\s*#/d; /^$/d' ~/04/sshd_config > ~/sshd_config.bak
```
阅读全文
相关推荐













