I have a CSV file which I am reading using the import-csv cmdlet. The file is similar to:
The problem is are the fields at the end with the headers SCSI1, SCS2 etc. There could be anything from 1 to 32 of these. I am doing the standard powershell stuff to read the file and process each line in it record at a time as shown below. I can get to each field no bother but the group at the end are proving to be a problem. I need to turn the values in the SCSI fields into an array. If there were a fixed number I could just do @($R.SCSI1, $R.SCSI2....) but there could be quite a few and the number could vary line by line.
Does anyone have any thoughts on how this could be done?
$recs = import-csv "data.csv"
foreach ($r in $recs)
.......process fields here