| | |
Windows batch script
![]() |
•
•
Join Date: Jun 2009
Posts: 9
Reputation:
Solved Threads: 0
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.
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.
Windows batch files isn't sophisticated enough to do all that. You will need to write a small program in one of the man programming languages such as C or C++.
Is this the output you want?
Is this the output you want?
•
•
•
•
AAAUSA-0046,AAAA,AAAAA061,100.00
AAAUSA-0057,AAAA CCCC -,AAAAA026,100.00
Press any key to continue . . .
Last edited by Ancient Dragon; Jun 28th, 2009 at 8:27 pm.
•
•
Join Date: Jun 2009
Posts: 9
Reputation:
Solved Threads: 0
I need it with out the commas, so that it can be put into an XLS spread sheet.
AAAUSA-0046 AAAA AAAAA061 100.00
AAAUSA-0057 AAAA CCCC AAAAA026100.00
The "AAAA" or "AAAA CCCC" would be in the second sell of the spread sheet.
Cell A1 would contain - AAAUSA-0057
Cell A2 would contain - "AAAA" or "AAAA CCCC"
Cell A3 would contain - AAAAA026
Cell A4 would contain - 100.00
AAAUSA-0046 AAAA AAAAA061 100.00
AAAUSA-0057 AAAA CCCC AAAAA026100.00
The "AAAA" or "AAAA CCCC" would be in the second sell of the spread sheet.
Cell A1 would contain - AAAUSA-0057
Cell A2 would contain - "AAAA" or "AAAA CCCC"
Cell A3 would contain - AAAAA026
Cell A4 would contain - 100.00
If you're using cygwin then you're not doing a windows batch script, you're more than likely using bash, sh, tcsh, zsh, etc. What shell are you running in cygwin?
![]() |
Similar Threads
- Delete a directory using batch script (Legacy and Other Languages)
- Changing a background in a batch script (Windows NT / 2000 / XP)
- Mysql Backup Batch Script (MySQL)
- Closing batch script after .exe is called (Windows NT / 2000 / XP)
- Batch Script - Error 7901??? (Windows NT / 2000 / XP)
- Problem with variables in Windows shell script (Windows NT / 2000 / XP)
Other Threads in the Shell Scripting Forum
- Previous Thread: EventHandler using Shell script
- Next Thread: how to prevent user close window during script execution?
| Thread Tools | Search this Thread |






