vim操作 与文件操作以及文件查看

  • Post author:
  • Post category:其他


(1) 应用vi命令在/tmp文件夹下创建文件,文件名newfile。在newfile首行输入日期时间

[root@localhost tmp]# vi /tmp/newfile

在首行输入时间

2,将/boot/grub2/grub.cfg文档的内容读入到newfile文档中(在日期的下一行即第2行)

在vi模式下输入”:”,进入命令模式,输入r /boot/grub2/grub.cfg 即可

3.查找文档中包含#号字符的行,将整行删除

:g/^#/d

4. 开启VI的行号提示功能

:set nu

2.文件查看:查看newfile文件的第6行

3.查找文件 /usr/share/xml/xml.xsd 中包含字符串 re 的所有行。将所有这些行的副本按原始顺序放在文件/root/files 中

[root@localhost /]# grep re  /usr/share/xml/xml.xsd  > /root/files
[root@localhost /]# cat /root/files
<?xml-stylesheet href="../../2008/09/xsd.xsl" type="text/xsl"?>
      See <a href="http://www.w3.org/XML/1998/namespace.html">
      <a href="http://www.w3.org/TR/REC-xml">
      Note that local names in this namespace are intended to be
      The names currently defined in this namespace are listed below.
      See further below in this document for more information about <a
      href="#usage">how to refer to this schema document from your own
      XSD schema documents</a> and about <a href="#nsversioning">the
       any element; its value is inherited.  This name is reserved
      Attempting to install the relevant ISO 2- and 3-letter
      going to be a realistic possibility.  
      See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
      and the IANA language subtag registry at
      <a href="http://www.iana.org/assignments/language-subtag-registry">
       http://www.iana.org/assignments/language-subtag-registry</a>
     <xs:restriction base="xs:string">
     </xs:restriction>
       value is inherited.  This name is reserved by virtue of its
   <xs:restriction base="xs:NCName">
    <xs:enumeration value="preserve"/>
   </xs:restriction>
       provides a URI to be used as the base for interpreting any
       relative URIs in the scope of the element on which it
       appears; its value is inherited.  This name is reserved
      href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
       should be interpreted as if declared to be of type ID.
       This name is reserved by virtue of its definition in the
      href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
  <xs:attribute ref="xml:base"/>
  <xs:attribute ref="xml:lang"/>
  <xs:attribute ref="xml:space"/>
  <xs:attribute ref="xml:id"/>
      the original XML Working Group.  This name is reserved by 
    In appreciation for his vision, leadership and
    February, 2000, reserves for Jon Bosak in perpetuity
     <pre>
     </pre>
     <pre>
     </pre>
      Subsequently, qualified reference to any of the attributes or the
      group defined below will have the desired effect, e.g.
     <pre>
           &lt;attributeGroup ref="xml:specialAttrs"/>
     </pre>
      <a href="http://www.w3.org/2009/01/xml.xsd">
      <a href="http://www.w3.org/2001/xml.xsd">
      The schema document at that URI may however change in the future,
      in order to remain compatible with the latest version of XML
      document at <a href="http://www.w3.org/2001/xml.xsd">
      <a href="http://www.w3.org/2009/01/xml.xsd">
      Previous dated (and unchanging) versions of this schema 
      document are at:
      <li><a href="http://www.w3.org/2009/01/xml.xsd">
      <li><a href="http://www.w3.org/2007/08/xml.xsd">
      <li><a href="http://www.w3.org/2004/10/xml.xsd">
      <li><a href="http://www.w3.org/2001/03/xml.xsd">



版权声明:本文为weixin_74812127原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。