Detailed awk for pagebreak in text file

Kindly provide detailed script (awk) programme for pagebreak to convert 500 lines text file into 60 lines each. I am a new learner in this platform. Pl guide

Hi, @Subramaniam
Why exactly 'awk'? There are other formatting tools.
Show your attempts

Hi everybody
In fact, this task, in my opinion, is not entirely ordinary. For some values, it’s not so easy to get the exact number of lines even if we initially split the file into a column with one word ...

1 Like

If I fold 8 lines into one, I get 63 lines

seq 500 | sed ':1;N;0~8! {$!b1}; s/\n/ /g' | tail -2
489 490 491 492 493 494 495 496
497 498 499 500

If 9 then 56

seq 500 | sed ':1;N;0~9! {$!b1}; s/\n/ /g' | tail -2
487 488 489 490 491 492 493 494 495
496 497 498 499 500

And if I leave the rest of 5 lines in the original, I will get 55 lines of 9 and plus 5 original and total 60 lines

seq 500 | sed ':1;N;0~9! b1; s/\n/ /g' | tail -6
487 488 489 490 491 492 493 494 495
496
497
498
499
500

The solution is not very elegant because it did not succeed to maintain uniformity.