GNU bug report logs -
#6780
Add cut multi-character/expression delimiters
Previous Next
Full log
View this message in rfc822 format
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
This bug report was last modified 15 years and 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.