2016年8月10日 星期三

[UNIX]10種使用split指令切割檔案的方法

參考網址:http://www.theunixschool.com/2012/10/10-examples-of-split-command-in-unix.html

最近用到的:每n行切為一個檔
2. Split file into multiple files with 3 lines each
$ split -l 3 file
The option -l specifies the number of lines per output file. Since the input file contains 7 lines, the output files contain 3, 3 and 1 respectively. The output files generated are: 
$ ls x*
xaa  xab  xac
$ cat xaa
Unix
Linux
AIX
  The file "xab" contains the 4th till 6th line, and the file "xac" contains the last line.

沒有留言: