Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2014
    Posts
    1

    Unanswered: Remove partial text from XML file

    I have test.xml XML file like

    <Report account="123456" start_time="2014-09-08T00:00:00+00:00" end_time="2014-09-10T23:59:59+00:00" user="Dollar Tree" limit="1000000" more_sessions="some text ">
    <Session ......rest of xml...............

    I need output like

    <Report>
    <Session ......rest of xml...............

    Can some one help me how to use of SED command to get the desired output..

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    try this:
    Code:
    awk '$1 == "<Report" {print substr($0,1,8)">"; next}{print}'
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •