chkconfig 查找出第一列,开头不包含0的
chkconfig|egrep -o "^[^0]+"|egrep -v "sshd|network|crond|sysstat"
awk取
#for i in $(chkconfig|awk '!/sshd|network|rysslog|crond/{print $1}')
#do
# echo "chkconfig $i off"
#don
egep不准确,第一个准
for i in $(chkconfig|egrep -o "^[a-z]+"|egrep -v "sshd|rsyslog|network|crond|sysstat")
do
echo "chkconfig $i off"
done
sed方法取
chkconfig|sed -rn '/sshd|network|crond|rsyslog/!s#(.*)0:.*#1#gp'