4
votes
6answers
137 views

sed first n occurrences result set between 2 tags / patterns

I have a big XML file and I get all occurrences between 2 tags: Here is what I do: sed -n '/<tag>/,/<\/tag>/p' file.xml And I need to filter to get only first N occurrences. I've ...
1
vote
1answer
753 views

How to find out the content of a XML file using Unix Sed/Awk? [duplicate]

I have a XML file(MyXML.xml) like this : <?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> ...
3
votes
3answers
1k views

Delete XML node containing certain element

I want to remove all Placemarks from a KML file that contain the element <tessellate>. The following block should be wholly removed: <Placemark> ...
2
votes
2answers
1k views

regex replace text in xml file within node from the command line

I have an XML file and I would like to replace everything that is between the open and closing tag within multiple instances of the g:gtin node with nothing. Is this possible from the command line, ...
3
votes
2answers
1k views

Insert a multiline string into another string

I need to insert lines into an xml file : Insert <one> </one> into <tags> </tags> To obtain <tags> <one> </one> </tags> I tried this: ...
2
votes
3answers
693 views

Clean up concatenated XML files

I'm trying to fix my Delicious export script to work with the new "trick" of only serving 1000 bookmarks at a time. The script concatenates results (XML) from multiple calls in a single file, and now ...
6
votes
1answer
4k views

Substitute text with sed and keep part of the original text

I am trying to convert <id>1</id> <Name>ENTERPRISE RESOURCE PLANNING</Name> to: <column name="id">1</column> <column name="Name">ENTERPRISE RESOURCE ...