I am new to PowerShell.
I have a file named c:\index.txt The files contains 1 to many rows each with seven columns separated by commas. The first and last column always have data. Columns two through six can be blank.
For each row in index.txt, I need to output column1-6,Column7 on a new line as long as column 1-6 has data.
index.txt original
ABC,DEF,123,456,1,2,foo1
A,D,1,,,,foo2
BC,F,13,,,,foo3
New desired file structure index.txt
ABC,foo1
DEF,foo1
123,foo1
456,foo1
1,foo1
2,foo1
A,foo2
D,foo2
1,foo2
BC,foo3
F,foo3
13,foo3