Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2015-07-07 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls