[CentOS] Cut command behaviour - bug or feature

Markus Falb markus.falb at fasel.at
Wed Aug 29 16:52:03 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29.8.2012 17:43, Rajagopal Swaminathan wrote:
> On Wed, Aug 29, 2012 at 2:15 AM, Markus Falb
> <markus.falb at fasel.at> wrote:
>> On 28.8.2012 21:59, Rajagopal Swaminathan wrote:
>> 
>> cut cuts out, that what it does. I think it works exactly as
>> advertised. On my system the manpage says
>> 
>> ...snip Selected input is written in the same order that it is 
>> read, and is written exactly once snap...
>> 
> 
> See below
> 
>>> Is it specific to linux?
>> 
>> No!
> 
> I would think, yes.

On a OS-X, and thats non arguably not linux-ish (means gnu-ish) but
bsd-ish

$ echo 1,2,3,4,5 | cut -d, -f3,1,5
1,3,5

So it's definitely not specific to linux.

> 
> From:
> http://www.unix.com/unix-dummies-questions-answers/117504-question-cut-command.html
>
>  [quote] ... In AIX (for example) if you said
> 
> Code: echo 1,2,3,4,5 | cut -d, -f3,1,5
> 
> you would get output as 3,1,5

I tend to think that AIX is not posix compliant, then.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cut.html

The behaviour of cut makes sense to me, actually. I remember one of
the UNIX paradigms and thats "do only one thing but do it good"

However, I realize that I do not suggest a better way to do what you
want to do, but I do not think I have to, there were so many hints in
this thread pointing you to awk and I remember actually one shell only
example.
- -- 
Kind Regards, Markus Falb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlA+SLIACgkQYoWFBIJE9eUJTwCfY7LL6BaE5gFJbBIeHoRrRpus
R0UAn3m7wjXIelJy36jYLbNexoue4NN4
=uVtC
-----END PGP SIGNATURE-----




More information about the CentOS mailing list