How to split file with a trick in bash -
i have 2 question in split
command:
1) how can split huge file in format?
x0 x1 . . . x10 . . .
2) how can split huge file in format?
0 1 . . . 10 . . . 100 . . .
what tried not satisfactory because result is:
x00 x01 x02 . . . x10 . . . x100 . . .
thank you
first question:
>> ls file >> split -a 1 -d file >> ls file x0 x1 x2 x3 ...
however, get
split: output file suffixes exhausted
with method if there more 9 split files. can use
>> split -d file >> ls file x00 x01 x02 ...
and use rename
:
>> rename 's/^x0/x/' x0* >> ls file x0 x1 x2 ...
second question: use
split -a 1 -d file ''
if have less 10 split files. otherwise, use
split -d file ''
and
rename 's/^0//' 0*
Comments
Post a Comment