split 切割檔案

使用方法: split [OPTION] [INPUT [PREFIX]]
  -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 

範例: 將 100000000 行的檔案 abc.log 分為多個檔案,每個檔案只有 5000 行

 split -l 5000 abc.log abc.split.log 

就會產生 abc.split.log.xx、abc.split.log.xy。。。檔案

This entry was posted in Linux. Bookmark the permalink.