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

Welcome Forums General PowerShell Q&A Wants to split value of single column to multiple columns in csv file

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
3 years, 4 months ago.

  • Author
    Posts
  • #31460

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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?

The topic ‘Wants to split value of single column to multiple columns in csv file’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort