New line after every 3 lines

Hi all,

My file is of below format:

abc,111,222,333
xyz,398,399,834
jdj,398,947,487
nmn,535,33,34
sss,43,3,53
ks,343,3,4
d,94,94999

I want to insert 2 rows(NULL,0,0,0) after every 3 lines. shown as below:

o/p:

abc,111,222,333
xyz,398,399,834
jdj,398,947,487
NULL,0,0,0
NULL,0,0,0
nmn,535,33,34
sss,43,3,53
ks,343,3,4
NULL,0,0,0
NULL,0,0,0
d,94,94999

could anyone help me ?:mad:

Use CODE-tags when displaying code, data or logs to enhance readability and to preserve formatting like indention etc., ty.

$> awk 'NR % 3 == 0 {print; print "NULL,0,0,0\nNULL,0,0,0"; next} {print}' infile
abc,111,222,333
xyz,398,399,834
jdj,398,947,487
NULL,0,0,0
NULL,0,0,0
nmn,535,33,34
sss,43,3,53
ks,343,3,4
NULL,0,0,0
NULL,0,0,0
d,94,94999

Thanks zaxxon.

A slight change,

My file is of below format:

abc,111,222,333,jjj,22
xyz,398,399,834,ww,33
jdj,398,947,487,eee,44
abc,535,33,34,jjj,22
sss,43,3,53,dd,ter,33
ks,343,3,4,jsj,33
d,94,94999,re,ere
cc,33,53453,xd,22
abx,343,33,jjj,55

As we can see in 5th column, "jjj", the number of rows between two jjj shoud be 7.

the o/p should be as :
abc,111,222,333,jjj,22
xyz,398,399,834,ww,33
jdj,398,947,487,eee,44
NULL,0,0,0,0,0
NULL,0,0,0,0,0
NULL,0,0,0,0,0
NULL,0,0,0,0,0
abc,535,33,34,jjj,22
sss,43,3,53,dd,ter,33
ks,343,3,4,jsj,33
d,94,94999,re,ere
cc,33,53453,xd,22
NULL,0,0,0,0,0
NULL,0,0,0,0,0
abx,343,33,jjj,55

could anyone help me ?