- 论坛徽章:
- 0
|
回复 6# guozl2118
指定行号的话,上面sed,awk都给出来了。。这边man一下split和paste
split 命令,可按行拆分文件
SPLIT(1) User Commands SPLIT(1)
NAME
split - split a file into pieces
SYNOPSIS
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.
-l, --lines=NUMBER
put NUMBER lines per output file
paste 可按列合并文件
PASTE(1) User Commands PASTE(1)
NAME
paste - merge lines of files
SYNOPSIS
paste [OPTION]... [FILE]...
DESCRIPTION
Write lines consisting of the sequentially corresponding lines from
each FILE, separated by TABs, to standard output. With no FILE, or
when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options
too.- personball@vostro:~$cat test1
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- personball@vostro:~$
- personball@vostro:~$split -l5 test1
- personball@vostro:~$ls
- test1 xaa xab
- personball@vostro:~$cat xaa
- 1
- 2
- 3
- 4
- 5
- personball@vostro:~$cat xab
- 6
- 7
- 8
- 9
- 10
- personball@vostro:~$paste xaa xab
- 1 6
- 2 7
- 3 8
- 4 9
- 5 10
- personball@vostro:~$
复制代码 |
|