Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Concatenate every 5 lines of input with a comma.

by ForgotPasswordAgain (Deacon)
on Jul 09, 2009 at 19:24 UTC ( #778673=note: print w/replies, xml ) Need Help??

in reply to Concatenate every 5 lines of input with a comma.

UPDATE: Oh, sorry, I'd only read the subject. I don't understand the body of your post.


perl -pe's/$/,/ if not$.%5' file

Replies are listed 'Best First'.
Re^2: Concatenate every 5 lines of input with a comma.
by jwkrahn (Monsignor) on Jul 09, 2009 at 21:06 UTC

    Not even close:

    $ seq 20 | perl -pe's/$/,/ if not$.%5' 1 2 3 4 5, 6 7 8 9 10, 11 12 13 14 15, 16 17 18 19 20,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://778673]
[atcroft]: .oO(Then there is the effect if a site changes their timezone, such as when the International Date Line was moved by the purchase of Alaska by the US from Russia in 1867, or several places (I cannot recall off-hand) that moved from one side of the Date
[atcroft]: Line to the other recently....)
[atcroft]: .oO(Then again, you also have to be careful if you had it to the database, and be aware of any assumptions it makes (such as SQLite assuming Gregorian calendar and a day of exactly 86400 seconds)...)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-04-29 04:53 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.