I am having a csv file of which I need to replace some fields for further processing. The header looks like this:
As powershell does not seem to like the double existence of the fields I want to change the second set of field names to something like:
It is unknown how many of these comment fields will show up.
I thought about using regular expressions but can't seem to figure out how to do this. A statement like
$p='^.*type(?:,([a-z0-9_-`s]+))+$' only seems to catch the last comment field.
I guess I am stuck on finding out how to catch all occurences after the "type" field as well as how to replace these. Any ideas are much appreciated.