Kyle Nelson
asked on
I need to edit a bunch of xml files within a specific directory. I would prefer to do this in a powershell script.
I have a directory on a server that has a ton of xml files that have some formatting issues with the end brackets in some of the files. I need the end brackets removed on certain lines where the attribute name is in bold. Removing the end bracket will un-bold the attribute name and fix the xml file. The format of the file names go as follows: 2016118E000013931.xml.sec (obviously the number tag after 2016118E changes per xml file). The formatting of each line of code in each xml file is the same and the extra end bracket where it is not needed occurs in the same location in the xml file. I'm still new at powershell so any help would be much appreciated.
The location of these files occurs in only one place on this server so the powershell script would only be looking in a specific directory location.
Thanks again,
The location of these files occurs in only one place on this server so the powershell script would only be looking in a specific directory location.
Thanks again,
What is your question?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I need help on getting started writing this powershell script to do so.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help. I was able to get this to work like a champ in my test directory. You have been a big help. This is the route I decided to go, please let me know what you think :-)
foreach ($file in dir){(Get-Content $file.PSPath) | ForEach-Object {$_ -replace "> "," "}| Set-Content $file.PSPath}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks again for all your help and sorry for the delay, my million other tasks are keeping me grounded and busy :-) I really do appreciate all the help! Thanks again!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I thought I did it the other day, I must've not have submitted. Thanks again for the help!
ASKER
Thanks again for all the help!!!