Louis I. answered 05/03/19
Computer Science Instructor/Tutor: Real World and Academia Experienced
So as you probably realize, the TAB character is the default delimiter for cut / paste ...
The cut "-d" option allows you to override that.
So if I wanted to view all HOME directory fields in the /etc/passwd file, I would issue the following command:
$ cut -d: -f6 /etc/passwd
/home/Administrator
/home/Guest
/home/HomeGroupUser$
/home/lji
/home/__vmware_user__
... displays the 6th field based on a delimiter of : (colan).
If we wanted to specify a space char as delimiter, we would need to wrap a space with single quotes.
For example:
cut -d' ' -f2 /some/file.txt
... displays the 2nd field based on a delimiter of SPACE
Raj R.
In Case you are using short option, give a space between -d and the delimiting character like -d ' ' Else You will get Error: the delimiter must be a single character...Else Use the long option --delimiter=' '08/05/22

Louis I.
08/05/22
Raj R.
short-option won't work as there can be only one character after -d option...Instead if you use -d' ' you will get Error: the delimiter must be a single character...To replace the default Delimiter, use the long option --delimiter=' '....08/05/22