Two years ago, I used Powershell to "build" a new PC - add programs, users, make changes, etc, etc.
Now I'm in the middle of writing a Perl script to parse through a CSV file and make some changes to the file to get it ready to be used by several other scripts (MySQL, sqlbatch60) and I'm running into some problems with one particular issue. I'm wondering if I could have tried using Powershell for this instead?
Need to read through millions of records and -
- Concatenate the first three fields with an underscore and append that newly concatenated field to the beginning of each line;
- Check one field that may have double quotes to contain commas, delete any commas between those quotes (and it's always only in that one field);
- Reformat three DATE fields from MM/DD/YYYY to YYYY-MM-DD;
- Reformat two DATETIME fields from MM/DD/YYYY 00:00 to YYYY-MM-DD 00:00;
And then write the newly parsed records back out to a file.
Is it possible to do all that using Powershell? I've been able to all of this in Perl, except one. The problem I'm running into is that second bullet point item - there is one field only that contains user input (field 7 using a 0-based index). And if there are any commas input by the users, that field will be surrounded by double quotes. The quotes are only there if the user inputs a comma, so it would be nice to get rid of those quotes after removing the comma as well.