Have you tried anything yet in Powershell? Most forums aren’t about writing code for people but rather helping people with what they’ve got.
Your first example should be achievable with “Replace” and regex. I suggest using Regex101.com to test your matching statements.
Then your second one, if I’m understanding it right, could probably be done with Sort-Object and the -Unique switch parameter.