1、备份配置文件
2、
sed去除注释行:sed -i -c -e '/^#/d' config_file
sed去除空行: sed -i -c -e '/^$/d' config_file
sed去空行和注释行:sed -i -c -e '/^$/d;/^#/d' config_file
cat /etc/inittab | grep -v ^# | grep -v ^$
grep "^$*[^#].*" /etc/inittab
grep "^$*[^#].*" /etc/inittab
grep "^\s*[^# \t].*$"
转载于:https://blog.51cto.com/151wqooo/1176724