Philip Ganchev wrote: > Brian Dessent wrote: > >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?
Agreed. It is much better to use awk. Awk has been around for many years and is a standard program. Don't let the fact that something is not a coreutils put you off. Neither is grep or sed or many other commands which are also standard commands on a system. echo one two three four | awk '{print $1, $(NF-1)}' one three NF is the number of fields on the line. $NF is therefore the last field on the line. Subtracting from it gives results from the end. > It is just sensical that if a command allows you to cut from the > beginning, it will let you cut from the end. Some utilities have more utility than others. Awk is so good at this that it is hardly worth the effort to do anything with cut. I only use it on occasions when I am wanting to cut by column and that only rarely. Bob _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils