作业帮 > 综合 > 作业

高分虚心求教编辑一个脚本,使用sed提取指定行中匹配的内容,并按照指定格式输出文本.

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/07/16 23:48:51
高分虚心求教编辑一个脚本,使用sed提取指定行中匹配的内容,并按照指定格式输出文本.
[root@server1 ]# vim /tmp/test.txt
Trying 192.168.0.7...^M
Connected to 192.168.0.7.^M
Escape character is '^]'.^M
1、首先提取从.这一行中,提取含有" "中的内容.
2、然后各行输出user online=" " ,login=" ",player count=" ",memory used=" ",free=" " ,total=" " 至mail.txt文本中.
高分虚心求教编辑一个脚本,使用sed提取指定行中匹配的内容,并按照指定格式输出文本.
grep -oP '((user online|login|player count|memory used|free|total)="([0-9]*)")' test.txt > mail.txt