in reply to Adding rows to column
Sounds like an identical question to Concatenate every 5 lines of input with a comma.. What follows is my earlier answer:
As a one-liner:
perl -ple'$\ = $. % 5 ? ";" : $/' infile > outfile
In-place:
perl -i.bak -ple'$\ = $. % 5 ? ";" : $/' file
If it wasn't a one-liner,
while (<$fh>) { chomp; print $_, $. % 5 ? ";" : $/; }
PerlMonks formatting tip: Use <c>...</c> around computer text (code and data), and use <p> at the start of each paragraph.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Adding rows to column
by Anonymous Monk on Jul 14, 2009 at 19:12 UTC | |
by SuicideJunkie (Vicar) on Jul 14, 2009 at 19:23 UTC | |
by Anonymous Monk on Jul 14, 2009 at 20:21 UTC |