Hi all,
I need to write an automated bash shell script which performs such operations:
- Grep the header of everyline with the initial of "T" in "FILE_A"
- Perform a for loop,
Count the numbers of comma in the line of code,
if (no. of comma < 17)
ADD the comma until 17;
save a new copy of the file with the new name of <fileName>_NEW;
else (if more than 17, Do nothing);
*p.s.: meaning that, each line with the header of "T" must have 17 commas.
correct example: T,XXXXX,X,"XXXX_XXXXX_XXXX",F,Y,5,1,A,3,-0.001,0.005,,,,,,
incorrect example: T,XXXXX,X,"IO_SHORT",P,Y,0,0 <MISSING COMMA>
I'm kinda of new to this language, please provide some brief explanation regarding the solution that you provided, your attention & effort are deeply appreciated.
Thank you very much & God blessed you all!!!