I'm new at scripting and I need help with converting multiple ".TXT" files to one ".CSV" file. Each file will have a different number of lines, then after the last line there is a blank line then more data, I don't want to use the data after the blank line. I need help with this today if possible.
The contents are as follows.
AAAUSA-0046 AAAA Functional Aggregate AAAAA061,100.00,0.00,0.00,good
AAAUSA-0057 AAAA CCCC - AAAAA026 - Functional Aggregate,100.00,0.00,0.00,good
Each line starts with the AAAUSA-nnnn, I need to have this in the first field of the CSV file. The second field in both lines will be different titles and some will include special characters.
The third field will be the "AAAAA061" .
The fourth will be the 100.00.
The "AAAAA061" and "AAAAA026" may be before or after the "Functional Aggregate", This isn't a big concern since I want to eliminate "Functional Aggregate".
Next I want to eliminate the commas and keep only the 100.00.
The output should look like this: for each row.
AAAUSA-0046 AAAAA AAAAA061 100.00
Field-1 = AAAUSA-0046
Field2 = AAAAA ( this could be multiple words with commas, dashes and spaces etc.)
Field3 = AAAAA061
Field4 = 100.00
Thanks in advance.