Delete until Nth occurence (sed, awk)

Hello people,
Once more I need your help with SED/AWK
I need to delete up to the Nth occurence of a char (from the beggining) and until the Mth occurence of a char (from the end)

Example:
Input:

a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z

Output:

i,j

Must delete up to the 8th comma from the beggining and upo to the 16th comma from the end.

For each line

Thank you in advance for your help.

Try:

sed 's/\([^,]*,\)\{8\}//; s/\(,[^,]*\)\{16\}$//' file
awk '{for(i=s+1;i<=NF-e;i++) printf("%s%c", $i,(i==NF-e)?ORS:OFS)}' s=8 e=16 FS=, OFS=, myFile
1 Like