How do I specify where to save files that result from running the unix split command? How do I specify where to save files that result from running the unix split command? unix unix

How do I specify where to save files that result from running the unix split command?


How about:

$ split -b 10 input.txt xxx/split-file

or

$ split -b 10 input.txt /tmp/split-file

Just include the output directory in the prefix specification. Keep in mind that the directory must be created beforehand.


This is the MacOS X (BSD) version of split, and includes some features of csplit:

split [-a suffix_length] [-b byte_count[k|m]] [-l line_count] [-p pattern] [file [name]]

The name specifies the prefix to the file name - the default is x, effectively ./x.

So, you do:

 split bigfile /lots/of/little/files/here

POSIX

The POSIX definition of split gives the synopses:

split [-l line_count] [-a suffix_length] [file [name]]split -b n[k|m] [-a suffix_length] [file [name]]

(The web site has a repeated typo - no space between file and [name].)