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

相关推荐

  • 亿级用户下的新浪微博平台架构

    序言     新浪微博在2014年3月公布的月活跃用户(MAU)已经达到1.43亿,2014年新年第一分钟发送的微博达808298条,如此巨大的用户规模和业务量,需要高可用(HA)、高并发访问、低延时的强大后台系统支撑。 微博平台第一代架构为LAMP架构,数据库使用的是MyIsam,后台用的是php,缓存为Memcache。 随着应用规模…

    2015-03-16
  • FTP服务

        FTP是一个非常古老的协议,其主要的作用是用于文件的传输。FTP采用明文的方式传输,极其不安全,但在局域网等环境中使用还是比较方便的。 一、工作原理     FTP的工作方式分为主动模式与被动模式。     1、主动模式 &nbsp…

    Linux干货 2015-07-08
  • TCP详解

    TCP协议详解   TCP/IP协议不是TCP和IP这两个协议的合称,而是指因特网整个使用TCP/IP协议的协议集合。他取代了OSI七层模型,成为事实上的应用于实际的模型。 TCP/IP协议与OSI协议的关系如下:   各层的作用如下: TCP特性: 工作在传输层面向连接协议 全双工协议 半关闭 错误检查 将数据打包成段,排序 确认机制 …

    2017-09-02
  • 第二周相关习题。

    习题 显示/var目录下所有以l开头,以一个小写字母结尾,且中间至少出现一位数字(可以有其它字符)的文件或目录。 [root@localhost /]# ls -d /var/l*[0-9]*[[:lower:]] 显示/etc目录下,以任意一个数字开头,且以非数字结尾的文件或目录。 [root@localhost&n…

    Linux干货 2016-11-05
  • 机器学习排序

     从使用的数据类型,以及相关的机器学习技术的观点来看,互联网搜索经历了三代的发展历程。        第一代技术,将互联网网页看作文本,主要采用传统信息检索的方法。        第二代技术,利用互联网的超文本结构,有效…

    Linux干货 2015-12-15
  • Linux的软件包管理(RPM)

    软件包管理(RPM)   本章节内容:   软件运行环境   软件包基础  Rpm包管理   一、软件运行环境(了解API和ABI)  API:应用程序开发接口,POSIX国际标准。  程序源代码–> 预处理–> 编译–&…

    Linux干货 2016-08-21