On Fri, 22 Sep 2006, Florin Iucha wrote:
> On Fri, Sep 22, 2006 at 03:52:11PM -0500, Mike Miller wrote:
>> See info below. So "cut -o" was rejected by the POSIX committee I guess,
>> but it seems like a good idea to me. If we can't have "cut -o", how about
>> a new program "cuto" that we can add to our systems if we want it? Has
>> any such thing been written? How hard would it be to write it? I guess
>> the "cut -o" plan was rejected about 7 years ago.
>
> You can use awk for that:
>
> $ cat | awk '{print $3 " " $2 " " $2 " " $2 " " $1}'
> This really works!
> ^D
> works! really really really This
>
> TMTOWTDI,
> florin
When there are three columns in and five columns out, I could use it, but
if this were the goal...
cut -o -c 91-112,7-12,1-6
...your method leads to an awful lot of typing! It's just too bad that
gawk doesn't allow the user to specify ranges of fields such as $3-$7.
I'll bet that perl is good for this kind of thing, but I'd need to know a
little more before I'd be able to do this quickly and easily. It would be
much better to have "cuto" if not "cut -o".
Mike