[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8070: cut command

From: Eric Blake
Subject: bug#8070: cut command
Date: Thu, 17 Feb 2011 15:46:07 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 02/17/2011 03:19 PM, George Gallen wrote:
> I'm not sure whether this is a bug or not.
> On Redhat Enterprise Linux, the cut command will accept the following " cut 
> -c0-5 " (Cut ver 5.97)
> On Fedora it will not accept the 0, it must be " cut -c1-5 " (cut ver 8.5)

Thanks for the report.

POSIX states this:


"The application shall ensure that the option-argument list (see options
-b, -c, and -f below) is a <comma>-separated list or <blank>-separated
list of positive numbers and ranges. Ranges can be in three forms. The
first is two positive numbers separated by a <hyphen> ( low- high),
which represents all fields from the first number to the second number.
The second is a positive number preceded by a <hyphen> (- high), which
represents all fields from field number 1 to that number. The third is a
positive number followed by a <hyphen> ( low-), which represents that
number to the last field, inclusive."

0 is not a positive integer, it lends itself to confusion (is the first
character 0-based or 1-based?), and coreutils had not documented it as
an explicit extension, therefore this functionality was removed as a bug
fix in 6.9.90:


And NEWS backs this up:

  cut now diagnoses a range starting with zero (e.g., -f 0-2) as invalid;
  before, it would treat it as if it started with 1 (-f 1-2).

> I was able to copy the cut command from RHEL to Fedora 14 and it works fine. 
> What am losing
>   between these two versions?

Your script was not POSIX compliant to begin with - it was pure luck
that it worked for you in older installations.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]