Wants to split value of single column to multiple columns in csv file

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Lauras Juozulynas Lauras Juozulynas 1 year, 8 months ago.

  • Author
    Posts
  • #31460
    Profile photo of mayank
    mayank
    Participant

    Want to split raw data in csv file (Column A) and to place values of Name in column A1, Package Category[All] in column B1, Version[All] in column C1 and Comment[All] in column D1.
    I've tried to make few changes in solution provided by Rob Simmers in thread https://powershell.org/forums/topic/need-to-split-the-values-in-few-cells-in-all-the-cells-in-csv/
    to suit my needs but unable to come up with the required format. Could anyone help me with this issue ?

    Raw Data in CSV file(Format available in csv file)
    COLUMN A:
    'Name','Package Category[All]','Version[All]','Comment[All]'
    'ABC','Security Patch','1.0.0.0','Installed on 3/9/2015'
    'EFG','Critical Update','3.0.0.0','Installed on 10/29/2014'
    'XYZ','Software','03.04.00','Installed on 10/29/15'

    Required Format

    COLUMN A:
    Name
    ABC
    EFG
    XYZ

    COLUMN B:
    Package Category[All]
    Security Patch
    Critical Update
    Software

    COLUMN C:
    Version[All]
    1.0.0.0
    3.0.0.0
    03.04.00

    COLUMN D:
    Comment[All]
    Installed on 3/9/2015
    Installed on 10/29/2014
    Installed on 10/29/15

  • #31461
    Profile photo of Lauras Juozulynas
    Lauras Juozulynas
    Participant

    Hi,

    A question about raw data you have. Is it just as you posted or does it have more columns? because if it is as you posted it is already in columns:

    $rawdata = Import-Csv 'C:\Temp\data.csv'
    $rawdata
    

    and results are already in columns (properties):

    'Name' 'Package Category[All]' 'Version[All]' 'Comment[All]'           
    ------ ----------------------- -------------- --------------           
    'ABC'  'Security Patch'        '1.0.0.0'      'Installed on 3/9/2015'  
    'EFG'  'Critical Update'       '3.0.0.0'      'Installed on 10/29/2014'
    'XYZ'  'Software'              '03.04.00'     'Installed on 10/29/15'  
    

    If you have more columns in raw data file, please provide how it looks.

    Or is it a task to remove symbol " ' " from items?

You must be logged in to reply to this topic.