in reply to Re: Concatenate every 5 lines of input with a comma.
in thread Concatenate every 5 lines of input with a comma.
perl -ple'$\ = $.%5 ? ";" : $/' infile > outfile
In-place:
perl -i.bak -ple'$\ = $.%5 ? ";" : $/' file
If it wasn't a one-liner, I wouldn't use $\
while ( <DATA> ) { chomp; print $_, $.%5 ? ";" : $/; }
|
|---|