http://www.perlmonks.org?node_id=1011739


in reply to perl one liner print columns 2.. last

Long ago on usenet, Tom Christiansen once wrote: "If you find yourself calling cat with just one argument, you're probably doing something silly". So you should lose the cat and replace:

cat /tmp/1.out|perl -lane 'print $F[1]..$F[-1]'
with (using the LanX slice idea):
perl -lane 'print join q{ }, @F[1..$#F]' /tmp/1.out
or:
perl -lape '$_=join q{ }, @F[1..$#F]' /tmp/1.out
or even (for variety, not recommended):
perl -lpe 's/\s*\S+\s*//' /tmp/1.out

Update: See also Re: perl one liner for csv file one field (useless use of cat and other awards References)

Replies are listed 'Best First'.
Re^2: perl one liner print columns 2.. last
by Jim (Curate) on Jan 06, 2013 at 17:23 UTC

    Also long ago on Usenet, there was the Useless Use of cat award, usually awarded to a practitioner of "cat abuse" by merlyn. I won one once!

    Jim