[TriLUG] vi or sed or perl question - joining lines

James Olin Oden james.oden at gmail.com
Fri Jun 1 17:28:14 EDT 2007


On 6/1/07, Mike Norwood <norwoodm at earthlink.net> wrote:
>
>
> Thanks again Craig,
>
> My data is now all shiny and presentable.
>
> Mike
>
I know its too late but the question tickled my interest, so here is
cli perl way:

   perl -ne 'chomp(); $. % 12 ? print : print "$_\n";'
/path/to/your/data > /path/to/your/transformed/data

or if you want to edit the file in place:

   perl -nie 'chomp(); $. % 12 ? print : print "$_\n";' /path/to/your/data

Also, really this is just the same script as the awk script, and if you put
"use English" in it, then you can use $NR.

Cheers...james

P.S. Ok, now were are the ruby and python examples (-:



More information about the TriLUG mailing list