The following script can select two columns from CSV files with headers.
import-csv file1 | select x,y
However, how to select column by index, for example column 9 and 10, from csv file without header?
import-csv file2 | select 9?,10?
The following script can select two columns from CSV files with headers.
import-csv file1 | select x,y
However, how to select column by index, for example column 9 and 10, from csv file without header?
import-csv file2 | select 9?,10?
So Import-CSV
isn't going to like a file with no headers, it will assume that your first record is the header unless you specify one. At that point you'll just assign headers to the columns, and you can reference those...
import-csv file2 -header Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12 | Select Col9,Col10