Convert Text file in to Excel file Or parsing Text file

This topic contains 2 replies, has 2 voices, and was last updated by  Suresh krishnan 1 year, 10 months ago.

  • Author
  • #46063

    Suresh krishnan

    Dear Community
    I have the below out put as a text file, how do I convert them in to powershell object with key value pair or convert them in to csv. I am only looking for Bay Server Name Serial Number Status Power UID Partner values.

    I am struggling with this . Any help would be appreciated. Thanks 🙂

    HP BladeSystem Onboard Administrator
    (C) Copyright 2006-2012 Hewlett-Packard Development Company, L.P.

    server name [SCRIPT MODE]> show server names

    Bay Server Name Serial Number Status Power UID Partner
    — —————————– ————— ——– ——- — ——-
    1 [Absent]
    2 Servernam1 SGH106XV7E OK On Off
    3 Servernam1 SGH106XV7H OK On Off
    4 Servernam1 TWT752000H OK Off Off
    5 [Absent]
    6 Servernam1 QS75MZ4620 OK On Off
    7 [Absent]
    8 [Absent]
    9 [Absent]
    10 [Subsumed]
    11 [Subsumed]
    12 [Subsumed]
    13 [Absent]
    14 [Absent]
    15 [Absent]
    16 [Absent]
    Totals: 4 server blades installed, 3 powered on.

    servername-m [SCRIPT MODE]>

  • #46091

    random commandline
    Import-Csv \\path\to\blades.txt -Delimiter ' ' -Header Bay,ServerName,
    SerialNumber,Status,Power,UID,Partner | Select-Object -Skip 7 | 
    Export-Csv \\path\to\blades.csv -NoTypeInformation
  • #46107

    Suresh krishnan

    Thank you random command line 😊. Will give it a try and let u know ..

You must be logged in to reply to this topic.