问题
So I'm using split command to split a file into separate lines and save them into a different directory than the current directory which I'm executing the command.
split -l 1 -d -a 5 --additional-suffix=.txt file1.dat file toindex/
so i want the output files to be written inside toindex/
, but this gives me a error saying:
split: extra operand ‘toindex/’
.
This works fine if I don't have the output dir path or don't have the prefix ("file").
How do I get this to work? I need to have the prefix as well as the additional-suffix.
回答1:
Try:
split -l 1 -d -a 5 --additional-suffix=.txt file1.dat toindex/file
Note that the directory toindex
must exist.
来源:https://stackoverflow.com/questions/34391181/writing-the-output-from-split-command-to-a-separate-directory