View Single Post
Old 09-16-2007   #2 (permalink)
Kiron


 
 

Re: Count the number of Columns/rows in a CSV file....

# assign csv data to a variable (optional)
$csv = import-csv data.csv

# column count
($csv | get-member -type NoteProperty).count

# ...or

(import-csv data.csv | get-member -type NoteProperty).count

# row count
# enclose the object in
# array notation '@()'
# ensuring the count of scalar objects

@($csv).count

# ...or

@(import-csv data.csv).count


--
Kiron

My System SpecsSystem Spec