For a data file containing following content:
$ cat file
Apr 24 2014;
is;
a;
sample;
;
Jun 24 2014 123
may 25 2014;
is;
b;
sample;
;
Dec 21 2014 987
You can do:
$ awk '{ORS=(NR%6?"":RS)}1' file
Apr 24 2014;is;a;sample;;Jun 24 2014 123
may 25 2014;is;b;sample;;Dec 21 2014 987
We set the Output Field Separator to print a new line (default value of RS
) after every 6th record.
You can redirect the output to another file by saying
awk '{ORS=(NR%6?"":RS)}1' file > newfile
or do the following to make changes to current file
awk '{ORS=(NR%6?"":RS)}1' file > tmp && mv tmp file