Edit CSV file

This topic contains 2 replies, has 1 voice, and was last updated by Profile photo of Tony Rodal Tony Rodal 1 week, 6 days ago.

  • Author
    Posts
  • #68461
    Profile photo of Tony Rodal
    Tony Rodal
    Participant

    Hi, I think I need some more sets of eyes on this and maybe I'm thinking of this wrong. I've been trying to get this to look right for the last couple of days. Maybe it can't be done but I thought I would post it for help. I'm running the following script to get the name and edmpolicy of the filtered AD Groups.

     get-adgroup -Filter { name -notlike "*_dom1*" -and name -notlike "*MAN*" } -Properties * -SearchBase "ou=esd,dc=dom1,dc=sch,dc=com" | select-object name,@{N='edmpolicy';E={$_.edmpolicy}} |  Select-Object -Property name,edmpolicy | Export-Csv -Path c:\progra~1\exports\ZSTREE.csv -delimiter "," –notype
    	(Get-Content c:\progra~1\exports\ZSTREE.csv) | % {$_ -replace '\+SOFTWARE\/',"   "} | out-file -FilePath c:\progra~1\exports\ZSTREE.csv -Force -Encoding ascii 

    I then edit it to take out the +software\ out of all the edmpolicy items and replace it with a couple of spaces. The csv file looks fine except if the edmpolicy has multiple items it places everything in the B column going horizontal. Is there any way to get it to place the multiple edmpolicy items going vertical? For example, here's' what it looks like.

    Column A (AD Group Name) Column B (edmpolicy)
    Default – Maint Lvl 1 APP40_CACHE_WIN7_TMPCLN_100512 APP40_CACHE_CLEAN_100412 BUFFER_FIX_052512

    What I would like it to look like.

    Column A (AD Group Name) Column B (edmpolicy)
    Default – Maint Lvl 1 APP40_CACHE_WIN7_TMPCLN_100512
    APP40_CACHE_CLEAN_100412
    BUFFER_FIX_052512

  • #68463
    Profile photo of Tony Rodal
    Tony Rodal
    Participant

    Hi, I think I need some more sets of eyes on this and maybe I'm thinking of this wrong. I've been trying to get this to look right for the last couple of days. Maybe it can't be done but I thought I would post it for help. I'm running the following script to get the name and edmpolicy of the filtered AD Groups.

     get-adgroup -Filter { name -notlike "*_dom1*" -and name -notlike "*MAN*" } -Properties * -SearchBase "ou=esd,dc=dom1,dc=sch,dc=com" | select-object name,@{N='edmpolicy';E={$_.edmpolicy}} |  Select-Object -Property name,edmpolicy | Export-Csv -Path c:\progra~1\exports\ZSTREE.csv -delimiter "," –notype
    	(Get-Content c:\progra~1\exports\ZSTREE.csv) | % {$_ -replace '\+SOFTWARE\/',"   "} | out-file -FilePath c:\progra~1\exports\ZSTREE.csv -Force -Encoding ascii 

    I then edit it to take out the +software\ out of all the edmpolicy items and replace it with a couple of spaces. The csv file looks fine except if the edmpolicy has multiple items it places everything in the B column going horizontal. Is there any way to get it to place the multiple edmpolicy items going vertical? For example, here's' what it looks like.

    Column A (AD Group Name) Column B (edmpolicy)
    Default – Maint Lvl 1 APP40_CACHE_WIN7_TMPCLN_100512 APP40_CACHE_CLEAN_100412 BUFFER_FIX_052512

    What I would like it to look like.

    Column A (AD Group Name) Column B (edmpolicy)
    Default – Maint Lvl 1 APP40_CACHE_WIN7_TMPCLN_100512
    APP40_CACHE_CLEAN_100412
    BUFFER_FIX_052512

  • #68467
    Profile photo of Tony Rodal
    Tony Rodal
    Participant

    Hi, I think I need some more sets of eyes on this and maybe I'm thinking of this wrong. I've been trying to get this to look right for the last couple of days. Maybe it can't be done but I thought I would post it for help. I'm running the following script to get the name and edmpolicy of the filtered AD Groups.

     get-adgroup -Filter { name -notlike "*_dom1*" -and name -notlike "*MAN*" } -Properties * -SearchBase "ou=esd,dc=dom1,dc=sch,dc=com" | select-object name,@{N='edmpolicy';E={$_.edmpolicy}} |  Select-Object -Property name,edmpolicy | Export-Csv -Path c:\progra~1\exports\ZSTREE.csv -delimiter "," –notype
    	(Get-Content c:\progra~1\exports\ZSTREE.csv) | % {$_ -replace '\+SOFTWARE\/',"   "} | out-file -FilePath c:\progra~1\exports\ZSTREE.csv -Force -Encoding ascii 

    I then edit it to take out the +software\ out of all the edmpolicy items and replace it with a couple of spaces. The csv file looks fine except if the edmpolicy has multiple items it places everything in the B column going horizontal. Is there any way to get it to place the multiple edmpolicy items going vertical? For example, here's' what column B looks like.

    Column B (edmpolicy)
    APP40_CACHE_WIN7_TMPCLN_100512 APP40_CACHE_CLEAN_100412 BUFFER_FIX_052512

    What I would like it to look like.

    Column B (edmpolicy)
    APP40_CACHE_WIN7_TMPCLN_100512
    APP40_CACHE_CLEAN_100412
    BUFFER_FIX_052512

You must be logged in to reply to this topic.