Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Best way to extract CSV data from a file in to an array

47 views
Skip to first unread message

madg...@gmail.com

unread,
Apr 14, 2013, 9:29:52 PM4/14/13
to
Hi Guys,

I have a CSV file exported from an LDAP query which I need to build an array from.
At the moment I have some fields containing commas surrounded by quotes.

"cn=JOHNSMITH,ou=SALES,o=COMPANY",JOHN,JOHN SMITH,,SMITH,,,"1 West Street, Westland",,,42,,,JOHN SMITH,,,,,,,,

What is the most elegant way to get an array with the items within the quotes intact.
as per below...

cn=JOHNSMITH,ou=SALES,o=COMPANY
JOHN
JOHN SMITH
:
SMITH
:
1 West Street, Westland
:
42
:
JOHNSMITH
:
:

I would prefer not to have to do it char by char as the export is rather large.

Thanks

G

Gloops

unread,
May 3, 2013, 12:33:55 AM5/3/13
to
Hello,

Char by char ?
I should be curious to know where you got your documentation of Powershell.
Try something like that :

get-content info.csv | convertfrom-csv

--




















0 new messages