On 12/3/06, Brian Dessent <[EMAIL PROTECTED]> wrote:
Philip Ganchev wrote:
> functionality very often when working with tabular data. Currently,
> the expression to achieve this is clumsy:
>
> cut -f 3,5-$(echo $(head -1 myfile | wc -w) - 3 | bc) myfile
You're right, that's very clumsy, especially the "head -1" part which is
problematic. (You should use the unambiguous "head -n 1" instead.)
Sure.
> The new syntax could use +1 to specify the last column, +2 to specify
> the second-last, etc. This syntax is the same as for the "tail"
> command. Then you can achieve the same as the above expression by
> writing:
>
> cut -f 3,5-+3 myfile
How about:
perl -F'\t' -nae 'print join "\t", @F[2,4..$#F-3]' myfile
Even more verbose and complicated (clumsy). Plus, it depends on
having Perl, which is not a coreutil as far as I know. If you are
going to use Perl, why do we need "cut" at all? It is just sensical
that if a command allows you to cut from the beginning, it will let
you cut from the end.
Brian
Philip
_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils