I want to use space as a delimiter with the cut
command.
What syntax can I use for this?
You can't do it easily with cut if the data has for example multiple spaces. I have found it useful to normalize input for easier processing. One trick is to use sed for normalization as below.
echo -e "foor\t \t bar" | sed 's:\s\+:\t:g' | cut -f2 #bar
I just discovered that you can also use "-d "
:
cut "-d "
$ cat a
hello how are you
I am fine
$ cut "-d " -f2 a
how
am