Reputation: 5972
when we use following command:
split -l 1000 test.txt
the result would be xaa xab xac ...
how can I put the out put to pattern made by me? for example: I want to do:
split -l 1000 test.txt
and the result should be:
0001 0002 0003 0004 ... 10000 10001...
I want to use numbers instead of xaa etc... thank you in advance.
Upvotes: 0
Views: 2211
Reputation: 753665
Find the man page for split
and with GNU split
(but not others, such as BSD split
as found on Mac OS X), you can use:
-d 100
to specify numeric suffixes starting at 100 (for example; or you can omit the number to start at 1), and:
-a 4
to specify that the suffixes should be (at least) 4 digits, and you can specify the prefix after the file name:
split -l 1000 -d 100 -a 4 test.txt prefix.
So, for your example, you could simply write:
split -d -a 4 test.txt ''
(since the default split is 1000 lines, which you specified explicitly as -l 1000
).
Upvotes: 2