I’m trying to run a split on a file where the filename has spaces in it.
I can’t seem to get it to work. So I have the following
SOURCE_FILE="test file.txt"
split -l 100 $SOURCE_FILE
Now I’ve tried enclosing the $SOURCE_FILE in " with no luck:
split -l 100 "\""$SOURCE_FILE"\""
or even
split -l 100 '"'$SOURCE_FILE'"'
I’m still getting:
usage: split [-l line_count] [-a suffix_length] [file [name]]
or: split -b number[k|m] [-a suffix_length] [file [name]]
You’re trying too hard! A single set of double quotes will suffice:
You want the arguments to split to look like this:
The commands you were trying both yield these arguments:
As in, they are equivalent to this incorrect command: