bug-textutils
[Top][All Lists]
Advanced

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

Re: bug in "cut"


From: Bob Proulx
Subject: Re: bug in "cut"
Date: Thu, 29 Nov 2001 21:00:14 -0700

> Please advise if there is some other procedure I am supposed to follow for
> reporting this, or if you need other information.

You reported to the correct bug reporting address.  But what you are
seeing is not a bug in cut program.  But rather it is an omission in
the documentation for it.

>  wc -l /tmp/vmtcpexit 
>     156 /tmp/vmtcpexit   
> 
>  wc -l /tmp/vmtcpexit | cut --fields=1
>     156 /tmp/vmtcpexit   
> 
>  wc -l /tmp/vmtcpexit | cut -f 1
>     156 /tmp/vmtcpexit   
> 
> in other words, "cut" does not appear to be cutting anything.

The 'info cut' page says:

`-f FIELD-LIST'
`--fields=FIELD-LIST'
     Print only the fields listed in FIELD-LIST.  Fields are separated
     by a TAB character by default.

But it should also say the following which is from the standards for
cut.

     Lines with no field delimiters will be passed through intact,
     unless -s is specified.

The HP-UX man page expands on this with the following:

     Lines with no field delimiters will be passed through intact
     (useful for table subheadings), unless -s is specified.

Therefore since your example does not include any TAB characters, that
is no field delimiters, the line will be passed through intact.

For the case of your example I would not recommend cut, but rather
awk.  Try the following instead.

  wc -l /tmp/vmtcpexit | awk '{print$1}'

Bob



reply via email to

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