Issue
I have a file with 200 lines in it. I want awk to read every 5 lines and create a file for it (whose file name will be file_#).
When program reads the first 5 lines, it will create file_1 for these 5 lines. When program reads 6-10 lines, it will create file_2 for those 5 lines. This has to be done till it reaches the end of file.
Solution
No need for awk
or anything fancy. Using GNU split
:
split --numeric-suffixes=1 -l5 file file_
Answered By - Shawn Answer Checked By - Robin (WPSolving Admin)