How to string the word in file content and convert into CSV from multiple file

Welcome Forums General PowerShell Q&A How to string the word in file content and convert into CSV from multiple file

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

 
Participant
1 year, 4 months ago.

  • Author
    Posts
  • #76354

    Participant
    Points: 0
    Rank: Member

    Hello!

    I have application file and content looks like below. Each file having 5

    or 6 server name in the content, same I have 800+ file under data folder.

    A sample of file content:-

    HOST "Developserver.com" Developserver.com
    {
    -trees
    "/"
    -exclude
    "/tmp/pro**"
    "/var/opt/Client"
    "/dev/__pv**"
    "/var/locks/slp.lock"

    }

    HOST "Testserver.com" Testserver.com
    {
    -trees
    "/"
    -exclude
    "/tmp/proc**"
    "/var/opt/Client"
    "/dev/__pv**"
    "/var/locks/slp.lock"

    }

    Now, how to read and string the content after "-exclude" and convert into

    csv format like this

    A Sample of Result:-

    FileName HostName Excludelist
    Dummy Developserver.com "/tmp/pro**"

    "/var/opt/Client"

    "/dev/__pv**"

    "/var/locks/slp.lock"

    Dummy Testserver.com "/tmp/pro**"

    "/var/opt/Client"

    "/dev/__pv**"

    "/var/locks/slp.lock"
    Any help much appreciated. Thx RR

  • #76400

    Participant
    Points: 264
    Helping Hand
    Rank: Contributor

    The following video might help you with your task Sophisitcated Techniques of Plain Text Parsing

The topic ‘How to string the word in file content and convert into CSV from multiple file’ is closed to new replies.