I want to use space as a delimiter with the cut command.
What syntax can I use for this?
To complement the existing, helpful answers; tip of the hat to QZ Support for encouraging me to post a separate answer:
Two distinct mechanisms come into play here:
(a) whether cut itself requires the delimiter (space, in this case) passed to the -d option to be a separate argument or whether it's acceptable to append it directly to -d.
(b) how the shell generally parses arguments before passing them to the command being invoked.
(a) is answered by a quote from the POSIX guidelines for utilities (emphasis mine)
If the SYNOPSIS of a standard utility shows an option with a mandatory option-argument [...] a conforming application shall use separate arguments for that option and its option-argument. However, a conforming implementation shall also permit applications to specify the option and option-argument in the same argument string without intervening characters.
In other words: In this case, because -d's option-argument is mandatory, you can choose whether to specify the delimiter as:
-d.Once you've chosen (s) or (d), it is the shell's string-literal parsing - (b) - that matters:
With approach (s), all of the following forms are EQUIVALENT:
-d ' '-d " "-d \ # used to represent an actual space for technical reasons With approach (d), all of the following forms are EQUIVALENT:
-d' '-d" ""-d "'-d 'd\The equivalence is explained by the shell's string-literal processing:
All solutions above result in the exact same string (in each group) by the time cut sees them:
(s): cut sees -d, as its own argument, followed by a separate argument that contains a space char - without quotes or \ prefix!.
(d): cut sees -d plus a space char - without quotes or \ prefix! - as part of the same argument.
The reason the forms in the respective groups are ultimately identical is twofold, based on how the shell parses string literals:
'...' is taken literally and forms a single argument"..." also forms a single argument, but is subject to interpolation (expands variable references such as $var, command substitutions ($(...) or `...`), or arithmetic expansions ($(( ... ))).\-quoting of individual characters: a \ preceding a single character causes that character to be interpreted as a literal.'...' or "..." or \ instances) - thus, the command being invoked never sees the quote characters.