文本如下:
ITEM 1: login screen welcome message|ges
RESULT: PASSED
ITEM 2.1: File /etc/rc.dt NOT exists|ges
RESULT: PASSED
ITEM 2.2: /usr/bin/X11/xhost permission
744|ges RESULT: PASSED
Item 3: Default user password policy and
umask|ges RESULT: PASSED
ITEM 4.1 password policy for system users|ges
RESULT: PASSED
ITEM 4.2 password policy for application
users|ges RESULT: PASSED
ITEM 4.3 password policy for system admin|ges
RESULT: PASSED
这个是我想要的结果
ges|info|ITEM 1:|login screen welcome
message|ges RESULT: PASSED
ges|info|ITEM 2.1:|File /etc/rc.dt NOT
exists|ges RESULT: PASSED
ges|info|ITEM 2.2:|/usr/bin/X11/xhost
permission 744|ges RESULT: PASSED
ges|info|Item 3:|Default user password policy
and umask|ges RESULT: PASSED
ges|info|ITEM 4.1|password policy for system
users|ges RESULT: PASSED
ges|info|ITEM 4.2|password policy for
application users|ges RESULT: PASSED
ges|info|ITEM 4.3|password policy for system
admin|ges RESULT: PASSED
中间有个判断passed为info,其他为error
执行文件代码如下:
- awk '{$2=$2"|";print $NF ~ /PASSED/ ? "ges|info|"$0 : "ges|error|"$0}'
阅读(186) | 评论(0) | 转发(0) |