vim编辑器作业

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

(0)
RecallWzcRecallWzc
上一篇 2016-08-12
下一篇 2016-08-12

相关推荐

  • 第十周

    1、请详细描述CentOS系统的启动流程(详细到每个过程系统做了哪些事情) 1.开启电源后,POST自检:检查硬件设备,通过后交给BIOS 2.BIOS加载可选择的启动设备,寻找可引导的启动设备的记录:MBR 3.MBR:硬盘的主引导记录,存在于0磁道0扇区,共512字节.其中Bootloader占用446字节,分区表占用64字节,magic nu…

    Linux干货 2016-10-17
  • vim编辑器总结与操作练习

    一、VIM总结如下: 模式化的编辑器 1、三种基本模式:     编辑模式(命令模式)     输入模式(插入模式)    末行模式:内置的命令行接口 2、如何使用VIM打开文件,编辑文件     打开文件:     #vim  【options】【file】     +n;打开文件后直接让光标处于第n行的行首     +/PATTERN:打开文件后,直接让…

    2017-11-29
  • hbase安装配置(整合到hadoop)

    1.  快速单击安装 在单机安装Hbase的方法。会引导你通过shell创建一个表,插入一行,然后删除它,最后停止Hbase。只要10分钟就可以完成以下的操作。 1.1下载解压最新版本 选择一个 Apache 下载镜像:http://www.apache.org/dyn/closer.cgi/hbase/,下载 HBase Re…

    Linux干货 2015-04-13
  • Linux逻辑卷LVM实现

    Linux逻辑卷LVM实现 背景: 在学习Linux中,学习到了逻辑卷LVM,发现LVM是个十分好用的一个技术,可以多个硬盘合并在一起使用,同时还可以动态的增加和减少。在这里将Linux逻辑卷的具体实现记录下来。 介绍: 逻辑卷LVM:Logica Volum Manager,它是Linux环境下对磁盘分区进行管理的一种机制,普通的磁盘分区管理方式在逻辑分区…

    2017-08-12
  • zabbix low-level discover 监控端口

    zabbix通过调用jason格式的输出,实现数据的收集 获取端口的shell脚本   #!/bin/bash port_array=(`netstat -tnl|egrep -i "$1"|awk {'print $4'}|awk -F':' '{if ($NF~/^[0-9]…

    Linux干货 2016-06-09
  • Linux 6.8系统安装操作过程

      首先按照好vmware 虚拟机,安装过程忽略。       虚拟机新建完毕后,在虚拟机设置框中,选择硬件cd/dvd,右侧勾选使用iso磁盘文件,点击浏览,选择所需镜像文件,点击确定按钮。      然后,单击启动虚拟机   &nbsp…

    2017-05-21