Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

split value of column and write along with key columns

$
0
0

I have a csv file one of them contains value separated by ;

Here is sample data
Region,OrderNo,OrderDate,ItemCount,ItemList
APC,APACBDDHKGUW142,7-Sep-14,3,IS13-073; IS14-009; IS14-011
APC,APACCNBJEXN0081,4-Sep-14,1,IS13-073
APC,APACCNBJIBDW799,3-Sep-14,2,IS14-009; IS14-011
APC,APACCNBJZGW0042,3-Sep-14,3,IS14-007; IS14-009; IS14-011
APC,APACCNDLBIN0100,3-Sep-14,3,IS14-007; IS14-009; IS14-011
APC,APACCNDLBIN0147,5-Sep-14,3,IS14-007; IS14-009; IS14-011
APC,APACCNDLBIW1354,5-Sep-14,3,IS14-007; IS14-009; IS14-011
APC,APACCNDLBIW3398,1-Sep-14,3,IS14-007; IS14-009; IS14-011
APC,APACCNDLBIW3401,3-Sep-14,1,IS13-091

Requirement is read the entire file split the value on ItemList column and write back to a new file along with the key columns, here is the example taking the first line

APC,APACBDDHKGUW142,7-Sep-14,3,IS13-073; IS14-009; IS14-011 will be out put as

APC,APACBDDHKGUW142,7-Sep-14,3,IS13-073
APC,APACBDDHKGUW142,7-Sep-14,3,IS14-009
APC,APACBDDHKGUW142,7-Sep-14,3,IS14-011

 


Viewing all articles
Browse latest Browse all 8583

Trending Articles