Replace with a variable in sed command

Hello,

I have this command and it works fine.
My question is that how can we replace the N by a variable, to print for instance a big number of lines. It means if I want 100 lines after an expression, to not put "N" 100 times in the sed.

Code:
$ sed -n '/aaa/{n;N;N;s/[ \n]//g;s/;/; /g;p;}' ttt2123 $ cat ttt20aaa12345678910
Thx & Regs,
Rany.

On linux

sed -n '/aaa/,+100p' ttt2123

OR

a=100
sed -n '/aaa/,+${a}p' ttt2123

will print next 100 lines after pattern "aaa" match.
OR use awk to get same output:

awk '/aaa/{nr=NR}{if(nr && NR<nr+100) print}' ORS=" " ttt2123

OR

awk '/aaa/{nr=NR}{if(nr && NR<nr+a) print}' a=100 ORS=" " ttt2123

ok, thx Singh