1、复制/etc/profile至/tmp/目录,用查找替换命令删除/tmp/profile文件中的行首的空白字符 [root@wzc tmp]# vim profile # By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200 # You could check uidgid reservation validity in # /usr/share/doc/setup-*/uidgid file if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null fi fi done unset i unset -f pathmunge ###:%s/^[[:space:]]\+//g 命令
2、复制/etc/rc.d/init.d/functions文件至/tmp目录,用查找替换命令为/tmp/functions的每行开头为空白字符的行的行首添加一个 # # # # # } # A sed expression to filter out the files that is_ignored_file recognizes __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' if [ "$_use_systemctl" = "1" ]; then # # # # # # # # # # fi ####:%s/^[[:space:]]\+.*/#/g 命令
3、如何设置tab缩进为4个字符? 160 shift 2 161 ;; 162 --check=?*) 163 base=${1#--check=} 164 gotbase="yes" 165 shift 166 ;; 167 --user) 168 user=$2 169 shift 2 170 ;; 171 --user=?*) 172 user=${1#--user=} 173 shift 174 ;; 175 --pidfile) 176 pid_file=$2 177 shift 2 178 ;; 179 --pidfile=?*) 180 pid_file=${1#--pidfile=} 181 shift 182 ;; ###:set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab nu autoindent cindent 命令
4、复制/etc/rc.d/init.d/functions文件至/tmp目录;替换/tmp/functions文件中的/etc/sysconfig/init为/var/log; # Read in our configuration if [ -z "${BOOTUP:-}" ]; then if [ -f /var/log ]; then . /var/log else # This all seem confusing? Look in /var/log, # or in /usr/share/doc/initscripts-*/sysconfig.txt BOOTUP=color RES_COL=60 MOVE_TO_COL="echo -en \\033[${RES_COL}G" SETCOLOR_SUCCESS="echo -en \\033[1;32m" SETCOLOR_FAILURE="echo -en \\033[1;31m" SETCOLOR_WARNING="echo -en \\033[1;33m" SETCOLOR_NORMAL="echo -en \\033[0;39m" LOGLEVEL=1 fi if [ "$CONSOLETYPE" = "serial" ]; then BOOTUP=serial ###:%s@/etc/sysconfig/init@/var/log@gi 命令
5、删除/tmp/functions文件中所有以#开头,且#后面至少有一个空白字符的行的行首的#号; A sed expression to filter out the files that is_ignored_file recognizes __sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' if [ "$_use_systemctl" = "1" ]; then if [ "x$1" = xstart -o \ "x$1" = xstop -o \ "x$1" = xrestart -o \ "x$1" = xreload -o \ "x$1" = xtry-restart -o \ "x$1" = xforce-reload -o \ "x$1" = xcondrestart ] ; then ###:%s@^#[[:space:]]\{1,\}@@ 命令
原创文章,作者:RecallWzc,如若转载,请注明出处:http://www.178linux.com/33338