本文标题:split 使用【本站如从外站转载,会注明出处】
本文链接:http://www.validba.net/2009/02/split-%e4%bd%bf%e7%94%a8/
split是linux下文件分割命令,对目标文件可以按行分割,也可以按大小进行分割.
[oracle@neworacle bdump]$ man split
SPLIT(1) FSF SPLIT(1)
SPLIT(1) FSF SPLIT(1)
NAME
split – split a file into pieces
split – split a file into pieces
SYNOPSIS
split [OPTION] [INPUT [PREFIX]]
split [OPTION] [INPUT [PREFIX]]
DESCRIPTION
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, …; default
PREFIX is `x’. With no INPUT, or when INPUT is -, read standard input.
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, …; 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.
too.
-a, –suffix-length=N
use suffixes of length N (default 2)
use suffixes of length N (default 2)
-b, –bytes=SIZE
put SIZE bytes per output file
put SIZE bytes per output file
-C, –line-bytes=SIZE
put at most SIZE bytes of lines per output file
put at most SIZE bytes of lines per output file
-l, –lines=NUMBER
put NUMBER lines per output file
put NUMBER lines per output file
–verbose
print a diagnostic to standard error just before each output
file is opened
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
output version information and exit
SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.
AUTHOR
Written by Torbjorn Granlund and Richard M. Stallman.
Written by Torbjorn Granlund and Richard M. Stallman.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright ?2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
Copyright ?2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
SEE ALSO
The full documentation for split is maintained as a Texinfo manual. If
the info and split programs are properly installed at your site, the
command
The full documentation for split is maintained as a Texinfo manual. If
the info and split programs are properly installed at your site, the
command
info split
should give you access to the complete manual.
我们常使用他分割alert文件或某些很大的trace文件.分割后的文件名默认前缀以字母’x'开头,后面为任意两个字母的组合共同组成文件名.前缀我们也可以自行定义.
[oracle@neworacle bdump]$ ls -lh alert_idctest.log
-rw-r–r– 1 oracle dba 827K Jun 24 13:23 alert_idctest.log
-rw-r–r– 1 oracle dba 827K Jun 24 13:23 alert_idctest.log
按行分割:
[oracle@neworacle bdump]$ split -l 1000 alert_idctest.log alert
[oracle@neworacle bdump]$ ls -l alert*
-rw-r–r– 1 oracle dba 46564 Jun 24 16:24 alertaa
-rw-r–r– 1 oracle dba 50905 Jun 24 16:24 alertab
-rw-r–r– 1 oracle dba 50824 Jun 24 16:24 alertac
-rw-r–r– 1 oracle dba 51676 Jun 24 16:24 alertad
-rw-r–r– 1 oracle dba 51314 Jun 24 16:24 alertae
-rw-r–r– 1 oracle dba 51576 Jun 24 16:24 alertaf
-rw-r–r– 1 oracle dba 51390 Jun 24 16:24 alertag
-rw-r–r– 1 oracle dba 51317 Jun 24 16:24 alertah
-rw-r–r– 1 oracle dba 51394 Jun 24 16:24 alertai
-rw-r–r– 1 oracle dba 51353 Jun 24 16:24 alertaj
-rw-r–r– 1 oracle dba 51494 Jun 24 16:24 alertak
-rw-r–r– 1 oracle dba 51227 Jun 24 16:24 alertal
-rw-r–r– 1 oracle dba 45925 Jun 24 16:24 alertam
-rw-r–r– 1 oracle dba 48046 Jun 24 16:24 alertan
-rw-r–r– 1 oracle dba 44002 Jun 24 16:24 alertao
-rw-r–r– 1 oracle dba 43035 Jun 24 16:24 alertap
-rw-r–r– 1 oracle dba 47827 Jun 24 16:24 alertaq
-rw-r–r– 1 oracle dba 6961 Jun 24 16:24 alertar
-rw-r–r– 1 oracle dba 846830 Jun 24 13:23 alert_idctest.log
[oracle@neworacle bdump]$ ls -l alert*
-rw-r–r– 1 oracle dba 46564 Jun 24 16:24 alertaa
-rw-r–r– 1 oracle dba 50905 Jun 24 16:24 alertab
-rw-r–r– 1 oracle dba 50824 Jun 24 16:24 alertac
-rw-r–r– 1 oracle dba 51676 Jun 24 16:24 alertad
-rw-r–r– 1 oracle dba 51314 Jun 24 16:24 alertae
-rw-r–r– 1 oracle dba 51576 Jun 24 16:24 alertaf
-rw-r–r– 1 oracle dba 51390 Jun 24 16:24 alertag
-rw-r–r– 1 oracle dba 51317 Jun 24 16:24 alertah
-rw-r–r– 1 oracle dba 51394 Jun 24 16:24 alertai
-rw-r–r– 1 oracle dba 51353 Jun 24 16:24 alertaj
-rw-r–r– 1 oracle dba 51494 Jun 24 16:24 alertak
-rw-r–r– 1 oracle dba 51227 Jun 24 16:24 alertal
-rw-r–r– 1 oracle dba 45925 Jun 24 16:24 alertam
-rw-r–r– 1 oracle dba 48046 Jun 24 16:24 alertan
-rw-r–r– 1 oracle dba 44002 Jun 24 16:24 alertao
-rw-r–r– 1 oracle dba 43035 Jun 24 16:24 alertap
-rw-r–r– 1 oracle dba 47827 Jun 24 16:24 alertaq
-rw-r–r– 1 oracle dba 6961 Jun 24 16:24 alertar
-rw-r–r– 1 oracle dba 846830 Jun 24 13:23 alert_idctest.log
按大小分割:
[oracle@neworacle udump]$ split -b 2000 idctest_ora_862_USERTRACE.trc USERTRACE
[oracle@neworacle udump]$ ls -l|grep "USERTRACE[a-z]"
-rw-r–r– 1 oracle dba 2000 Jun 24 16:33 USERTRACEaa
-rw-r–r– 1 oracle dba 215 Jun 24 16:33 USERTRACEab
[oracle@neworacle udump]$ ls -l|grep "USERTRACE[a-z]"
-rw-r–r– 1 oracle dba 2000 Jun 24 16:33 USERTRACEaa
-rw-r–r– 1 oracle dba 215 Jun 24 16:33 USERTRACEab

CopyRight Validba'S Home 版权所有.本站为个人学习之用,评论时请遵守本国法律