This kind of work I do with AWK. For current project I need to convert the output of a huge Paradox export to something which I can import in MySQL.
What the script does:
- Filter records matching certain criteria
- Check values for null values, either generate an error message or replace it by \N if null is allowed
- Concatenate strings
- Replace strings with numbers if they must become enumerated values for my database
- Print each record in a tab delimited format.
The Paradox files are sent to me in a regular fashion, I call awk from a bask script, and loads the result in the database.
It takes you about a day or so to understand awk and crank out the basic code.
If your export is a CSV file with quoted strings, do not try to process this with AWK. Simple cases are fine, but if you find a string like:
Code:
onevalue, "Sherlock asked: "What do you think, Watson?"", nextvalue
AWK chokes on that and many unsuccesful attempts have been made to implement this. Find a CSV preprocessor for that. If you can't find it, I have a good public domain application. It used to be available on the internet but it seems to have disappeared. If you need it, let me know.
jlinkels