Subject: bug#6780: Problem with the cut command

From: Bill <[email-masked]>
Date: Mon, 02 Aug 2010 05:56:31 -0700

Hello,

I'm not sure if this is a bug, a question or a feature request,
but there is a problem with the cut command, specifically with
it's delimiter option '-d'. 

In older times disk space was scarce and every byte was 
conserved. Fields in data files were delimited with a single
character such as ':'. This practise continues today. But 
sometimes it does not and fields in some files are separated
with multiple characters. Space is no longer precious.

Suppose I wish to import information about a disk partition
into my backup script. I want to assign the type of filesystem
to a variable. Compare the output of these two commands.

cat /etc/fstab |grep home | cut -d ' ' -f3
yields a blank output line

cat /etc/fstab |grep opt | awk -F " " '{print $3}'
yields the desired output - reiserfs.

The problem is that the cut command can't handle multiple 
instances of the same delimiter. It's designed to handle
a single character like ':', but can't cope with repeating
characters like '::' or a series of spaces as in /etc/fstab.

So my question is shouldn't the cut delimiter handle 
multiple instances of the same character internally or 
failing that, shouldn't there be some way of specifying a 
series of single delimiter characters such as -d':'+  ?

I hope this is useful feedback and look forward to your reply.

	Bill McGrath