Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: perl one liner print columns 2.. last

by eyepopslikeamosquito (Canon)
on Jan 04, 2013 at 23:34 UTC ( #1011739=note: print w/ replies, xml ) Need Help??


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


Comment on Re: perl one liner print columns 2.. last
Select or Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011739]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2014-07-28 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (210 votes), past polls