tags:

views:

518

answers:

2

I'm using CSVDE to export data from our active directory into a CSV file, which then gets imported into a database. I'm using the -l switch to specify the columns that I'd like to export, but they don't come out in the same order consistently. Is there a workaround for this that doesn't involve opening the file in Excel? This is a nightly batch process and we'd like it to run unattended.

Thanks!

A: 

Per the docs:

LDAP can return attributes in any order, and csvde does not attempt to impose any order on the columns.

How about writing a python script to read reorder the csv file? You may find the python csv module useful for this.

A: 

If you simply want a command-line utility that can re-order the CSV (and do much else as well), take a look at my FOSS CSV stream editor, CSVfix.

anon