Re: Cut command behaviour - bug or feature

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



On Wed, Aug 29, 2012 at 11:52 AM, Markus Falb <markus.falb@xxxxxxxx> wrote:
>>
>> 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"

So sed with a regexp?
 sed  -e 's/\([^,]*\),\([^,]*\),\([^,]*\)/\1\3\2/'

-- 
   Les Mikesell
     lesmikesell@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux