To compliment the helpful answer from y y with some more background to add to your learning curve:
Delimiters
Let's start with defining the delimiters:
$Delimiters = ';', '/'
To avoid multiple embedded native PowerShell loop (that could make you script pretty expensive) we are going to use a regular expresion (regex). This allows us to split the concerned fields upon any of the delimiters in once and is not limited to a single character.
$RegexPattern = @($Delimiters).foreach{ [Regex]::Escape($_) } -Join '|'
The [basic concept] for the regular expression (https://en.wikipedia.org/wiki/Regular_expression#Basic_concepts) here is based on a:
Boolean "or"
A vertical bar separates alternatives. For example, gray|grey can match "gray" or "grey".
Note that as any of the $Delimiters could potential contain a special regex characters (as the | character itself) it is important to escape ([Regex]::Escape($_)) these delimiters first.
Input object
In general, it is advised to create a Minimal, Reproducible Example that prospective answerers can easily understand and use to reproduce the problem. This would usually included some code and and easy access to the input data which better would be a simple Csv expression (I uses Read-HtmlTable to pull your data):
Read-HtmlTable https://stackoverflow.com/q/78812449/1701026 -Table 0 | Export-Csv .\List.csv
Import-Csv .\List.csv
Art. No. Attribute Bullet Point
-------- --------- ------------
1 a;b;c d/e/f
2 g;h; i/j/k/l
3 m;n;o;p;q r/s
Iterate
To iterate through the $ObjectsList, I am going to use the ForEach-Object cmdlet which is able to do one-at-a-time processing. To find the property names and - values, it requires to use the intrinsic member PSObject property. For more background, see: Everything you wanted to know about PSCustomObject/Working with properties and e.g. this StackOverflow question
$Delimiters = ';', '/'
$RegexPattern = @($Delimiters).foreach{ [Regex]::Escape($_) } -Join '|'
Import-Csv .\List.csv | ForEach-Object {
$Properties = [Ordered]@{}
foreach ($Property in $_.PSObject.Properties) {
$Properties[$Property.Name] = $Property.Value
$Split = $Property.Value -Split $RegexPattern
if ($Split.Count -gt 1) {
$Index = 1
foreach ($Item in $Split) {
$Properties["$($Property.Name)$Index"] = $Item
$Index++
}
}
}
[PSCustomObject]$Properties
} | Format-Table
Art. No. Attribute Attribute1 Attribute2 Attribute3 Bullet Point Bullet Point1 Bullet Point2 Bullet Point3
-------- --------- ---------- ---------- ---------- ------------ ------------- ------------- -------------
1 a;b;c a b c d/e/f d e f
2 g;h; g h i/j/k/l i j k
3 m;n;o;p;q m n o r/s r s
Pitfall
But as you (and y y in the initial attempt 😊) might have noticed, there is a pitfall in this approach:
In general: even all properties still exist in the individual objects. PowerShell uses the first object to presume the properties that will follow in a pipeline. Note that this problem also exhibits in cmdlets as Export-Csv.
A purposed for a common workaround for this issue, can be found at: #13906 Add -UnifyProperties parameter to Select-Object.
function UniteProperties {
$hash = [ordered]@{}
$i = @($input)
foreach ($obj in $i) {
foreach ($p in $obj.psobject.properties) {
$hash[$p.name] = $true
}
}
$i | Select-Object ($hash.keys | ForEach-Object tostring)
}
ForEach-Object { ... } | UniteProperties | Format-Table *
Art. No. Attribute Attribute1 Attribute2 Attribute3 Bullet Point Bullet Point1 Bullet Point2 Bullet Point3 Bullet Point4 Attribute4 Attribute5
-------- --------- ---------- ---------- ---------- ------------ ------------- ------------- ------------- ------------- ---------- ----------
1 a;b;c a b c d/e/f d e f
2 g;h; g h i/j/k/l i j k l
3 m;n;o;p;q m n o r/s r s p q
This explains the initial comments from Santiago Squarzon and Mathias R. Jessen. Columns are named, it is difficult to address any sub-item (as. e.g. Attribute9) not knowing if it even exists.