Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8106361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:26:32+00:00 2026-06-06T00:26:32+00:00

NOT USING A XML PARSER I want to get the contents of the XML

  • 0

NOT USING A XML PARSER
I want to get the contents of the XML tag so my XML file looks like ( Includes more than XML this is just the XML part )

<ns1:CarrierServiceId>PD_PRIVATPAKKER_W</ns1:CarrierServiceId>
<ns1:LabellingReturned>0</ns1:LabellingReturned>
<ns1:DeliveryDate>2012-07-27T23:00:00Z</ns1:DeliveryDate>
<ns1:DespatchDate>2012-07-26T22:59:59Z</ns1:DespatchDate>
<ns1:International>0</ns1:International>
<ns1:ClearanceDocumentation>0</ns1:ClearanceDocumentation>
<ns1:ExceptionCode>0</ns1:ExceptionCode>

How would i get the contents of CarrierServiceId so i only get PD_PRIVATPAKKER_W and nothing else i’ve managed to get the line using below, but i need the contents

FOUND=$(awk '/<ns1:CarrierServiceId>/ {print $1}' TEST.tmp)

echo "${FOUND}"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:26:33+00:00Added an answer on June 6, 2026 at 12:26 am

    Use the angle brackets as delimiters and print the field.

    FOUND=$(awk -F '[<>]' '/<ns1:CarrierServiceId>/ {print $3}' TEST.tmp)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I'm not using any session variables, rather my code looks like this:
I am using GWT and want to parse an xml file, but I get
I'm using JPA 2.0 and want to create a unique constraint using XML, not
I'm trying to search for data in a XML File using php. I'm not
I want to pull in data using a XML::XPath parser from a XML DB
I am using some XML parser to get some information from API, blah blah...
I have xml file in server. I am parsing this xml using DOM(xml is
I am trying to parse a xml file using dom parser. The xml fles
I have code which parses XML that looks like this: <custom_fields> <custom_field> <column_name>foo</column_name> <column_value>0</column_value>
I'm using the TBXML parser. I'm not sure this is specific to TBXML or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.