Мне нужно удалить часть HTML из всего контекста HTML с помощью powershell. Для этого я использовал функцию repace, но получил ошибку ниже:
-replace span ...
+
+ CategoryInfo : InvalidArgument: (:) [Get-Content], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetContentCommand
Вот код:
Get-Content 'C:\Users\name surname\Desktop\original.txt' -replace '<span class="jsd-approval-buttons"><span class="jsd-stretcher-glue" style="white-space: nowrap"><span
class="jsd-stretcher-proper" style="display: inline; display: inline-block; height: 0; line-height: 2.143"> </span><a h
ref="https://servername/servicedesk/customer/user/approval-action/aaa-427/11715/approve/analytics?sda_sourc
e=notification-email" class="jsd-approval-button jsd-approve-button" style="background-color: #ebecf0; border-color:
transparent; color: #344563; border-radius: 3.010px; border-style: solid; border-width: 1px; text-decoration: none; cursor:
pointer; background-color: #0052cc; border-color: transparent; color: #ffffff; font-weight: 600; margin: 0; vertical-align:
baseline; white-space: nowrap; border-width: 1px; padding: 4px 10px; line-height: 1.429; box-sizing: content-box; height:
1.429em; display: inline; display: inline-block" bgcolor="#0052cc">Approve</a><span class="jsd-stretcher-proper"
style="display: inline; display: inline-block; height: 0; line-height: 2.143"> </span></span>
<span class="jsd-stretcher-glue" style="white-space: nowrap"><span class="jsd-stretcher-proper" style="display: inline;
display: inline-block; height: 0; line-height: 2.143"> </span><a href="https://servername/servicedesk/c
ustomer/user/approval-action/aaa-427/11715/reject/analytics?sda_source=notification-email" class="jsd-approval-button"
style="background-color: #ebecf0; border-color: transparent; color: #344563; border-radius: 3.010px; border-style: solid;
border-width: 1px; text-decoration: none; cursor: pointer; margin: 0; vertical-align: baseline; white-space: nowrap;
border-width: 1px; padding: 4px 10px; line-height: 1.429; box-sizing: content-box; height: 1.429em; display: inline;
display: inline-block" bgcolor="#ebecf0">Decline</a><span class="jsd-stretcher-proper" style="display: inline; display:
inline-block; height: 0; line-height: 2.143"> </span></span></span>'