how to put nil at the end of each records.

Hello,

I have a file with 100,000 records. Each record have many fileds and used "," to split (like below):

0100,apple,john,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,
0201,steve,2435,N,0,49,6.658,0,6.658,37.104302,0,0,0,0,0,37.104302,0,49,6.658,0,6.658,37.104302,UAE,AED
222,cu1,marry,2436,N,0,3,0.416,0,0.416,2.318322,0,0,0,0,0,2.318322,0,3,0.416,0,0.416,2.318322,UAE,AED

however, some of them at the end is empty. Can i put the NIL?

Itried to use "sed -e "s/,,/,NIL,/g" a.txt > b.txt", but it's not work.

expected output:
0100,apple,john,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,NIL
0201,steve,2435,N,0,49,6.658,0,6.658,37.104302,0,0,0,0,0,37.104302,0,49,6.658,0,6.658,37.104302,UAE,AED
222,cu1,marry,2436,N,0,3,0.416,0,0.416,2.318322,0,0,0,0,0,2.318322,0,3,0.416,0,0.416,2.318322,UAE,AED

or check the front information and put the same?

0100,apple,john,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,
0100,orange,et,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,ACC
0201,steve,2435,N,0,49,6.658,0,6.658,37.104302,0,0,0,0,0,37.104302,0,49,6.658,0,6.658,37.104302,UAE,AED
222,cu1,marry,2436,N,0,3,0.416,0,0.416,2.318322,0,0,0,0,0,2.318322,0,3,0.416,0,0.416,2.318322,UAE,

OUTPUT:
0100,apple,john,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,ACC
0100,orange,et,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,ACC
0201,steve,2435,N,0,49,6.658,0,6.658,37.104302,0,0,0,0,0,37.104302,0,49,6.658,0,6.658,37.104302,UAE,AED
222,cu1,marry,2436,N,0,3,0.416,0,0.416,2.318322,0,0,0,0,0,2.318322,0,3,0.416,0,0.416,2.318322,UAE,AED

echo '0100,apple,john,2233,N,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,IDN,' | sed 's/,$/&NIL/'

it's not work :(:(:frowning: