Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: perl one liner print columns 2.. last

by philipbailey (Chaplain)
on Jan 04, 2013 at 19:03 UTC ( #1011701=note: print w/ replies, xml ) Need Help??

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

Works for me. I would suggest that you show us (an extract) of your input file.

echo 1 2 3 4 5 6|perl -lane 'print $F[1]..$F[-1]' 23456

Are your columns separated by whitespace?

Update: Of course, this doesn't work, for the reasons given by LanX in his reply to this (too hasty) posting.

Comment on Re: perl one liner print columns 2.. last
Download Code
Replies are listed 'Best First'.
Re^2: perl one liner print columns 2.. last
by LanX (Chancellor) on Jan 04, 2013 at 19:24 UTC
    Sorry thats wrong, your test data is misleading you :)

    you are calculating the numerical range between 2 and 6, which by accident was your input.

    now change the input in between:

    > echo - 2 - - - 6|perl -lane 'print $F[1]..$F[-1]' 23456

    but a slice works: =)

    > echo - 2 - - - 6|perl -lane 'print @F[1..$#F]' 2---6

    Cheers Rolf

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2016-02-12 12:19 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (397 votes), past polls