shell命令之split

來源:互聯網
上載者:User

聽人說做文本分類時處理100G的文字檔,居然不用大資料,處理方法就是用shell的split去分割成若干小檔案。


split命令

NAME       split - split a file into piecesSYNOPSIS       split [OPTION] [INPUT [PREFIX]]DESCRIPTION       Output  fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is       ‘x’.  With no INPUT, or when INPUT is -, read standard input.       Mandatory arguments to long options are mandatory for short options too.       -a, --suffix-length=N              use suffixes of length N (default 2)       -b, --bytes=SIZE              put SIZE bytes per output file       -C, --line-bytes=SIZE              put at most SIZE bytes of lines per output file       -d, --numeric-suffixes              use numeric suffixes instead of alphabetic       -l, --lines=NUMBER              put NUMBER lines per output file       --verbose              print a diagnostic to standard error just before each output file is opened       --help display this help and exit       --version              output version information and exit       SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.

-l按行分割檔案

-b按指定大小分割檔案,支援b,k,m

例:

split -b 256m result_guid_active_train_all small

ll -lh

-rw-rw-r-- 1  256M Jun 17 20:29 smallaa
-rw-rw-r-- 1  256M Jun 17 20:29 smallab
-rw-rw-r-- 1  256M Jun 17 20:29 smallac
-rw-rw-r-- 1  256M Jun 17 20:29 smallad
-rw-rw-r-- 1  256M Jun 17 20:29 smallae
-rw-rw-r-- 1  256M Jun 17 20:29 smallaf
-rw-rw-r-- 1  256M Jun 17 20:29 smallag
-rw-rw-r-- 1  256M Jun 17 20:29 smallah
-rw-rw-r-- 1  256M Jun 17 20:29 smallai
-rw-rw-r-- 1  256M Jun 17 20:29 smallaj






























相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.