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

  • SEARCH
  • Home
  • 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 8995655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:38:56+00:00 2026-06-15T23:38:56+00:00

I have a series of XML files produced from a data playback utility. The

  • 0

I have a series of XML files produced from a data playback utility. The utility produces correctly formed XML tags. Unfortunately, the utility isn’t perfect. Some of the Java objects it attempts to serialize fail and they are simply inserted (as binary blobs) in between these other, valid XML tags.

For example…

<track>
<cto>Valid_XML_HERE</cto>@Binary_Blob_of_Junk@<cto>(...)</cto>
</track>

Environment is RHEL-5, which means Python 2.4, Perl, or SED/AWK solutions are usable.

Any suggestions on how to remove the junk?

  • 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-15T23:38:57+00:00Added an answer on June 15, 2026 at 11:38 pm

    I built off of Birei’s suggestion to inspect tree elements, but came up with a SED-only solution. As shown in the OP, the <cto> tags happen to be on one continuous line. The solution, then, was to split the lines such that each <cto> tag was on a new line — thus, also isolating the junk binary data on new lines — and then simply select lines starting with a <cto> tag.

    The <tracks> and </tracks> tag can simply be added to the new file via CAT.

    Here are the SED commands that I’ve tested and confirm to work…

    Step 1. Isolate the <cto> tags to be on new lines.

    sed -i "s/<cto/\n<cto/g;s/<\/cto>/<\/cto>\n/g" ${FILE}
    

    Step 2. Select only the lines starting with a <cto> tag.

    sed -i "/<cto/p" ${FILE}
    

    Step 3. Format the new XML document.

    xmllint --format "${FILE}" > foo.xml
    

    Thanks for all of your respective inputs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of complicated XML files from Amazon showing order reports. A
I have a series of... pseudo-xml files. What I mean by this, is they
Let's say I have a series of xml files in this format: A.xml: <page>
I have a series of XML files which can be retrieved, edited and saved
I have a series of XML files which I need to add a few
I have a series of very complex XML files. I need to access these
I have a series of xml files that looks something like this: <ROOT> <F
I have a series of XML files which reference XSLT files to render as
I have just written a program for importing data from an xml file to
I have an XML file that lists a series of items, and the items

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.