I have an input file having 7 fields delimited by ,
eg :
1,ABC,hg,1,2,34,3
2,hj,YU,2,3,4,
3,JU,kl,4,5,7,
4,JK,KJ,3,56,4,5

The seventh field here in some lines is empty, whereas the other lines there is a value.
How do I insert string NULL at this location (7th loc) for these lines where output will look like
1,ABC,hg,1,2,34,3
2,hj,YU,2,3,4,NULL
3,JU,kl,4,5,7,NULL
4,JK,KJ,3,56,4,5

Usually, you would use either of '' or "" (adjacent quotation marks) to show an empty trailing field. The other option is to pick a 'never otherwise used' marker and use it whenever a NULL is needed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.