credog
asked on
Sed question
I was looking a a sed command online (which seems to work fine) and didn't understand why the recommended solution included a [^>]. I don't think it's needed, so I was hoping someone could explain why the poster may have thought it was. Here's the jist of the questions an recommended solution.
User had a xml file which was all on one line (for clarity it's broken up into multiple lines below) and looked something like this:
s> from the line in the file. The recommended solution which seems to work fine was:
User had a xml file which was all on one line (for clarity it's broken up into multiple lines below) and looked something like this:
<Point><Time>2014-02-12T18:18:49+11:00</Time>
<Position><Lat>35.209656</Lat><Lon>28.99924</Lon></Position>
<AltMeters>586.99994</AltMeters>
<DisMeters>148.30713</DisMeters>
<Cad>4</Cad>
</Point>
The user wanted to remove all occurrences of <DisMeters>.....</DisMetersed 's/<DisMeters>[^>]*>//g' file
Why include the [^>], which negates the >? Doesn't seem needed or am I missing something?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER