<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<queryResponse xmlns="http://autotask.net/ATWS/v1_6/">
<queryResult>
<ReturnCode>1</ReturnCode>
<EntityResults>
<Entity xsi:type="Ticket">
<id>4359</id>
<UserDefinedFields/>
<AccountID xsi:type="xsd:int">234</AccountID>
<AllocationCodeID xsi:type="xsd:int">79220810309</AllocationCodeID>
<CompletedDate xsi:type="xsd:dateTime">2015-10-06T06:42:09.013</CompletedDate>
<ContactID xsi:type="xsd:int">3882394</ContactID>
<CreateDate xsi:type="xsd:dateTime">2015-10-06T06:34:34.15</CreateDate>
<CreatorResourceID xsi:type="xsd:int">4334141</CreatorResourceID>
<Description xsi:type="xsd:string">Launch Ec2 Instance</Description>
<DueDateTime xsi:type="xsd:dateTime">2015-10-07T22:34:34.15</DueDateTime>
<IssueType xsi:type="xsd:int">15</IssueType>
<LastActivityDate xsi:type="xsd:dateTime">2016-01-21T07:58:46.913</LastActivityDate>
<Priority xsi:type="xsd:int">1</Priority>
<QueueID xsi:type="xsd:int">2313</QueueID>
<Source xsi:type="xsd:int">-6</Source>
<Status xsi:type="xsd:int">4</Status>
<SubIssueType xsi:type="xsd:int">445</SubIssueType>
<TicketNumber xsi:type="xsd:string">REQ00000007865.0002</TicketNumber>
<Title xsi:type="xsd:string">Do something</Title>
<FirstResponseDateTime xsi:type="xsd:dateTime">2015-10-06T06:34:34.15</FirstResponseDateTime>
<ResolutionPlanDateTime xsi:type="xsd:dateTime">2015-10-06T06:42:00</ResolutionPlanDateTime>
<ResolvedDateTime xsi:type="xsd:dateTime">2015-10-06T06:42:00</ResolvedDateTime>
<FirstResponseDueDateTime xsi:type="xsd:dateTime">2015-10-06T18:34:34.15</FirstResponseDueDateTime>
<ResolvedDueDateTime xsi:type="xsd:dateTime">2015-10-07T22:34:34.15</ResolvedDueDateTime>
<ServiceLevelAgreementID xsi:type="xsd:int">880</ServiceLevelAgreementID>
<Resolution xsi:type="xsd:string"/>
<PurchaseOrderNumber xsi:type="xsd:string"/>
<TicketType xsi:type="xsd:int">333</TicketType>
<ChangeApprovalType xsi:type="xsd:int">1</ChangeApprovalType>
<ChangeApprovalStatus xsi:type="xsd:int">1</ChangeApprovalStatus>
<ChangeInfoField1 xsi:type="xsd:string"/>
<ChangeInfoField2 xsi:type="xsd:string"/>
<ChangeInfoField3 xsi:type="xsd:string"/>
<ChangeInfoField4 xsi:type="xsd:string"/>
<ChangeInfoField5 xsi:type="xsd:string"/>
<LastCustomerNotificationDateTime xsi:type="xsd:dateTime">2015-10-06T06:34:50.927</LastCustomerNotificationDateTime>
<LastCustomerVisibleActivityDateTime xsi:type="xsd:dateTime">2015-10-06T06:42:09.013</LastCustomerVisibleActivityDateTime>
<TicketCategory xsi:type="xsd:int">3</TicketCategory>
<ExternalID xsi:type="xsd:string"/>
<FirstResponseInitiatingResourceID xsi:type="xsd:int">296</FirstResponseInitiatingResourceID>
<CreatorType xsi:type="xsd:int">1</CreatorType>
<CompletedByResourceID xsi:type="xsd:int">11</CompletedByResourceID>
<LastActivityPersonType xsi:type="xsd:int">3</LastActivityPersonType>
<LastActivityResourceID xsi:type="xsd:int">9</LastActivityResourceID>
</Entity>
</queryResult>
</queryResponse>
</soap:Body>
</soap:Envelope>
В приведенном выше ответе SOAP API мне нужно проанализировать TicketNumber, который присутствует между <TicketNumber xsi:type="xsd:string">REQ00000007865.0002</TicketNumber>
.
Есть ли способ добиться этого, используя sed
или awk
в сценарии оболочки?
Я попробовал следующее, но это ничего не дало:
sed -n 's|<TicketNumber xsi:type="xsd:string">\(.*\)</TicketNumber>|\1|p' response.xml