⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 文件的切分split和结合工具cat 介绍 linuxsir_org.htm

📁 linuxSir 网站的精华文章
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0040)http://www.linuxsir.org/main/?q=node/200 -->
<HTML lang=zh-hans xml:lang="zh-hans" 
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>文件的切分split和结合工具cat 介绍 | LinuxSir.Org</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css media=all>@import url( misc/drupal.css );
</STYLE>


<STYLE type=text/css media=all>@import url( modules/taxonomy_context/taxonomy_context.css );
</STYLE>
<LINK media=screen 
href="文件的切分split和结合工具cat 介绍  LinuxSir_Org.files/menuExpandable3.css" 
type=text/css rel=stylesheet>
<SCRIPT src="文件的切分split和结合工具cat 介绍  LinuxSir_Org.files/menuExpandable3.js" 
type=text/javascript></SCRIPT>
<LINK href="文件的切分split和结合工具cat 介绍  LinuxSir_Org.files/common.css" type=text/css 
rel=stylesheet>
<STYLE type=text/css media=all>@import url( themes/chameleon/marvin/style.css );
</STYLE>

<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV id=header><A title=Home href="http://www.linuxsir.org/main/"><IMG alt=Home 
src="文件的切分split和结合工具cat 介绍  LinuxSir_Org.files/logo.jpg"></A></DIV>
<DIV class=navlinks>
<DIV class=primary><A href="http://www.linuxsir.org/main/?q"><FONT 
color=white>首页</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/34"><FONT 
color=white>事件</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/1/25/"><FONT 
color=white>文档</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/35/48/"><FONT 
color=white>资源</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=search"><FONT color=white>搜索</FONT></A> | 
<A href="http://www.linuxsir.org/bbs"><FONT color=white>论坛</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/38"><FONT 
color=white>贡献者</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=node/3"><FONT color=white>关于</FONT></A> | 
<A href="http://www.linuxsir.org/main/?q=user"><FONT 
color=white>注册/登录</FONT></A></DIV></DIV>
<TABLE id=content>
  <TBODY>
  <TR>
    <TD id=sidebar-left>
      <DIV class="block block-block" id=block-block-1>
      <H2 class=title>子站索引</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://fedora.linuxsir.org/" target?_blank?>Fedora中文</A> 
        <LI><A href="http://debian.linuxsir.org/" target?_blank?>Debian中文</A> 
        <LI><A href="http://lfs.linuxsir.org/" target?_blank?>LFS 中文</A> 
        <LI><A href="http://slack.linuxsir.org/">Slackware</A> 
        <LI><A href="http://gentoo.linuxsir.org/">Gentoo中文</A> 
        <LI><A href="http://arch.linuxsir.org/">Arch 中文</A> </LI></UL></DIV></DIV>
      <DIV class="block block-block" id=block-block-3>
      <H2 class=title>重要资讯</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/36">本站公告</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/34">新闻事件</A> 
        <LI><A href="http://www.linuxsir.org/bbs" target=_blank>本站论坛</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/38">贡 献 者</A> 
        </LI></UL></DIV></DIV>
      <DIV class="block block-block" id=block-block-7>
      <H2 class=title>项目索引</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.fcitx.org/" target=_blank>小企鹅输入法</A> 
        <LI><A href="http://lumaqq.linuxsir.org/" target=_blank>LumaQQ</A> 
        <LI><A href="http://openq.linuxsir.org/" target=_blank>OpenQ</A> 
        <LI><A href="http://www.relaxbsd.org/" target=_blank>RelaxBSD</A> 
      </LI></UL></DIV></DIV>
      <DIV class="block block-user" id=block-user-1>
      <H2 class=title>站点导航</H2>
      <DIV class=content>
      <DIV class=menu>
      <UL>
        <LI class=leaf><A title=注册/登录 
        href="http://www.linuxsir.org/main/?q=user">注册/登录</A> 
        <LI class=collapsed><A 
        href="http://www.linuxsir.org/main/?q=aggregator">新闻聚合</A> 
      </LI></UL></DIV></DIV></DIV>
      <DIV class="block block-aggregator" id=block-aggregator-feed-2>
      <H2 class=title>LinuxSir.Org 论坛</H2>
      <DIV class=content>
      <DIV class=item-list>
      <UL>
        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266922&amp;goto=newpost">如何在FvwmButtons中使用系统托盘?</A> 

        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266921&amp;goto=newpost">FC5 
        root 的垃圾箱被彻底删掉了,怎么恢复?</A> 
        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266920&amp;goto=newpost">我想做一个mini 
        linux 该怎么下手呢~</A> 
        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266919&amp;goto=newpost">FC5体验之影音篇</A> 

        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266918&amp;goto=newpost">请教高手:FEDORA 
        4 安装问题</A> </LI></UL></DIV>
      <DIV class=more-link><A title=查看此feed的最新消息 
      href="http://www.linuxsir.org/main/?q=aggregator/sources/2">更多</A></DIV></DIV></DIV>
      <DIV class="block block-user" id=block-user-2>
      <H2 class=title>最新注册</H2>
      <DIV class=content>
      <DIV class=item-list>
      <UL>
        <LI>horiwa
        <LI>jiechu
        <LI>emiss
        <LI>ismart
        <LI>mynamewsy</LI></UL></DIV></DIV></DIV>
      <DIV class="block block-user" id=block-user-3>
      <H2 class=title>当前在线</H2>
      <DIV class=content>0 users 和 71 游客 在线</DIV></DIV></TD>
    <TD id=main>
      <DIV class=breadcrumb><A href="http://www.linuxsir.org/main/?q=">首页</A> » 
      <A href="http://www.linuxsir.org/main/?q=taxonomy/term/1">Linux</A></DIV>
      <H2>文件的切分split和结合工具cat 介绍</H2><!-- begin content -->
      <DIV class=node>
      <DIV class=content>
      <P><B>作者:</B>北南南北<BR><B>来自:</B>LinuxSir.Org<BR><B>摘要:</B>文件的切分工具split和文件的结合工具cat,是我们偶尔用到的工具。初学的弟兄可能需要了解一下,有时我们在系统管理中还是需要的;</P>
      <P><FONT size=4><B>目录</B></FONT></P>
      <UL><A 
        href="http://www.linuxsir.org/main/?q=node/200#1">1、文件的切分及结合工具;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/200#2">2、文件的切分工具 split 
        和csplit;</A>
        <P></P>
        <UL><A href="http://www.linuxsir.org/main/?q=node/200#2.1">2.1 split 
          工具;</A>
          <P></P>
          <UL><A href="http://www.linuxsir.org/main/?q=node/200#2.11">2.11 
            语法格式;</A><BR><A 
            href="http://www.linuxsir.org/main/?q=node/200#2.12">2.12 
            split实例应用;</A> </UL>
          <P><A href="http://www.linuxsir.org/main/?q=node/200#2.2">2.2 csplit 
          工具;</A> </P></UL>
        <P><A href="http://www.linuxsir.org/main/?q=node/200#3">3、文件的连接工具 
        cat;</A></P>
        <UL><A href="http://www.linuxsir.org/main/?q=node/200#3.1">3.1 
          把多个文件合并到一个新的文件中;</A><BR><A 
          href="http://www.linuxsir.org/main/?q=node/200#3.2">3.2 
          把多个文件合并追加到一个已存在的文件中;</A> </UL>
        <P><A 
        href="http://www.linuxsir.org/main/?q=node/200#4">4、关于分拆文件和连接文件的安全性;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/200#5">5、关于本文;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/200#6">6、后记;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/200#7">7、参考文档;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/200#8">8、相关文档;</A> </P></UL>
      <P><FONT 
      color=blue><B><BR>++++++++++++++++++++++++++++++++++++++<BR>正文:<BR>++++++++++++++++++++++++++++++++++++++<BR></B></FONT></P>
      <P><FONT id=1 size=4><B><BR>1、文件的切分及结合工具;<BR></B></FONT></P>
      <P>可能我们遇到这种情况,有时文件比较大,想上传到服务器上,但由于服务器管理员为了安全考虑,把上传空间作了限制,比如只能上传20M的文件,如果我们文件的体积在100M的,有时就是压缩也不能满足服务器上传的限制。这时我们就要考虑切分文件了,把100M的文件,切分成若干份,然后传到服务器上。切分后的每个文件都是原文件的组成部份。如果要获得整个完整的文件,我们就需要文件的结合工具。</P>
      <P>所以我们引入了文件切分工具split和csplit,文件的结合工具cat;</P>
      <P><FONT id=2 size=4><B><BR>2、文件的切分工具 split 和csplit;<BR></B></FONT></P>
      <P>split 是把一个文件拆分为长度或体积相等的若干文件的工具;</P>
      <P><FONT id=2.1 size=3><B><BR>2.1 split 工具;<BR></B></FONT></P>
      <P>split 是把一个文件拆分为长度或体积相等的若干文件的工具;</P>
      <P><FONT id=2.11 size=2><B><BR>2.11 语法格式;<BR></B></FONT></P>
      <P>
      <DIV class=codeblock><CODE>split [参数选项] infile [outfile]</CODE></DIV>
      <P></P>
      <P>split 把输入的文件拆分为若干体积或长度相等的文件,输入文件保持不变,只是把结果拆分结果写到outfileaa、outfileab ... 
      ... 等文件中。如果我们不指定outfile,被拆分后的文件会写到 xaa、xab ... ...。<BR><B>参数</B></P>
      <P>
      <DIV class=codeblock><CODE>-l n 把infile拆分为具有n行的段,默认值为1000<BR>-b n[bkm] 
      以体积为单位的拆分,约定每拆分后每个文件的大小 ,b代表512B,k代表1KB,m代表1MB。<BR>-C bytes[bkm] 
      把bytes的最大值放入文件,坚持增加完整的行;<BR>- 从标准输入读取;<BR>--help 帮助;</CODE></DIV>
      <P></P>
      <P><FONT id=2.12 size=2><B><BR>2.12 split实例应用;<BR></B></FONT></P>
      <P><B>实例一:</B>比如我们想切分一个文件linuxdoc.txt,切分后,每两行存为一个新文件。</P>
      <P>
      <DIV class=codeblock><CODE>[root@localhost ~]# more linuxdoc.txt 
      注:linuxdoc.txt 
      文件内容查看;<BR>111111111<BR>222222222<BR>333333333<BR>444444444<BR>555555555<BR>666666666<BR>777777777<BR>888888888<BR>999999999<BR>000000000<BR>[root@localhost 
      ~]# split -l 2 linuxdoc.txt linuxdocsp 
      注:切分linuxdoc.txt文件,被切分后的文件名linuxdocsp开头<BR>[root@localhost ~]# ls 
      linuxdocspa* 注:查看切分后的所有文件;<BR>linuxdocspaa linuxdocspab linuxdocspac 
      linuxdocspad linuxdocspae<BR>[root@localhost ~]# more linuxdocspa* 
      注:查看这些文件的内容;是不是每个文件都是两行呢?<BR>linuxdocspaa<BR>::::::::::::::<BR>111111111<BR>222222222<BR>::::::::::::::<BR>linuxdocspab<BR>::::::::::::::<BR>333333333<BR>444444444<BR>::::::::::::::<BR>linuxdocspac<BR>::::::::::::::<BR>555555555<BR>666666666<BR>::::::::::::::<BR>linuxdocspad<BR>::::::::::::::<BR>777777777<BR>888888888<BR>::::::::::::::<BR>linuxdocspae<BR>::::::::::::::<BR>999999999<BR>000000000</CODE></DIV>
      <P></P>
      <P><B>实例二:</B>以文件体积为单位的切分;</P>
      <P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -