A simple, very flexible text format that stands for eXtensible Markup Language.

learn more… | top users | synonyms

9
votes
1answer
6k 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 ...
9
votes
1answer
2k views

Vim: Making XML text “pretty”

Is there an easy way within vi to make your XML text "pretty"? For example: I want this.. <person> <name>Nick</name> <age>26</age> ...
8
votes
2answers
1k views

Parsing XML's , JSON's and newer data file formats in UNIX using command line utilities

Unix environment has some excellent tools for parsing text in various forms. However off late the data is not in the regular set of formats(CSV,TSV,Record based or some other delimiter based) it used ...
7
votes
2answers
2k views

Reformatting a large number of XML files

I'm manipulating a large number of XML files scattered throughout a nested directory structure. I tried the following (which almost works): $ find . -name "*.xml" -type f | xargs -- xmllint --format ...
7
votes
1answer
325 views

How can I split Openbox `rc.xml` into multiple files?

I don't like big text configuration files. So, I would like to split my rc.xml file into multiple files: rc.xml rc.keyboard.xml rc.mouse.xml
5
votes
5answers
26k views

Parse XML to get node value in bash script?

I would like to know how I can get the value of a node with the following paths: config/global/resources/default_setup/connection/host config/global/resources/default_setup/connection/username ...
5
votes
2answers
723 views

VIM jump from one xml tag to the closing one

Is there a shortcut to jump from , e.g <XX> to </XX> ? I already give it a try with '%' , but it doesn't work for this situation.
5
votes
1answer
6k views

how to compare two xml files having same data in different lines?

I have two files have same data but in different lines. File 1: <Identities> <Identity> <Id>048206031415072010Comcast.USR8JR</Id> ...
4
votes
6answers
974 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 ...
4
votes
5answers
329 views

Insert Lines after Multi-Line Regex Match

I've got an XML file I need to append to after a specific set of tags. Basically the file structure looks like this: <key>servers</key> <dict> ... Server Details ... </dict> ...
4
votes
2answers
74 views

How to add a line from a list into another file when a specified line is found?

Basically I have 2 files. One has a list of router and switch login prompts, like this: user@router1 user@router2 user@switch1 user@switch2 The other file has blocks of XML, like this: ...
4
votes
2answers
1k views

Parsing XML from a shell script

I have a datafile like this: <Key name="com.ahsay.afc.cpf.UserGroup" content="" allowMultiple="Y"> <Value name="rsv-id" inheritParentAttribute="Y" type="string" data="1328200856753" ...
3
votes
3answers
3k 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> ...
3
votes
2answers
3k views

How do I parse namespaces from an XML file using XMLLINT and BASH

Below I have an example of an Adobe XML swidtag used to track inventory. I need to parse out relevant information using xmllint in bash and output that to a new text file. For example I would like ...
3
votes
1answer
969 views

Convert xml subtitle file to srt format

I have a xml subtitle that looks like this: <?xml version="1.0" encoding="utf-8" ?><transcript> <Item from="1.16" duration="4.68"><![CDATA[(Dong-hyuk is coming to see you now.) ...
3
votes
2answers
2k 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: ...
3
votes
4answers
435 views

Shell script or command to Strip text and Binary files excerpts from large Log Files

I need to remove a large binary file (PDF file) from a large log file which is generated daily.This is seriously hogging space on our servers.I need to remove the large PDF from the logs to make the ...
3
votes
1answer
1k views

Is there an XML file editor for Linux with grid view support?

I have been using Altova XML Editor on Windows for a long time. It has a wonderful feature that lets you view XML files in "grid view." This makes life easy when reading very complex XML. My question ...
3
votes
0answers
85 views

Convert Evolution filters.xml file to Thunderbird msgFilterRules.dat?

I migrated evolution to Thunderbird yesterday. I googled for migrate filters, but Evolution stores them as an XML file and Thunderbird stores using a Mork formatted file such as: version=`9` logging= ...
3
votes
2answers
8k views

xmllint display values of more than 1 attributes in single execution

I am using xmllint to parse xml file which has several tags and each tag has several attributes. Sample structure as shown below: <root> <child attr1="abc" attr2="def" attr3="ghi" /> ...
2
votes
5answers
167 views

Re-order text on each line in a file

I'm processing a log file and I need reorder each line (not sort). The log file looks like this: 11-06-2014 - 10:49:06PM lat = 41.858657; lon = -91.345142 11-06-2014 - 10:49:49PM lat = ...
2
votes
3answers
158 views

How to extract only a part of one line?

I want to extract the essid in a dump file from airodump-ng using grep. The part where I want to extract looks like this: <SSID first-time="Wed Feb 25 07:06:57 2015" last-time="Wed Feb 25 ...
2
votes
2answers
384 views

How do I actually read an XML file in human form that makes sense?

I downloaded a catalog and it is in XML format. How do change it from code to human-readable form, and ideally save it as a plain text file? I've never worked/seen these before; I tried messing with ...
2
votes
1answer
69 views

Substite values from file1 to file2 awk

I have input file in xml FILE1 : <Sector sectorNumber="1"> <Cell cellNumber="1" cellCreated="YES" cellIdentity="" cellRange="35000" numberOfTxBranches="1" hsCodeResourceId="0"/> ...
2
votes
2answers
2k 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, ...
2
votes
3answers
814 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 ...
2
votes
1answer
54 views

XML command line tool postgres

I have an XML files to read and load into database daily at night (cron) So i planed to do this in a batch. Is there any command line tool to : 1. Create a postgres schema using an XSD file? 2. ...
2
votes
1answer
175 views

How can I setup ~/.tidyrc file for XML?

How do you configure tidy to parse XML instead of HTML? Explanation: A while ago, a co-worker showed me a trick to use tidy to clean up XML. Apparently, you create a tidyrc file like so: ...
2
votes
1answer
146 views

Is there a command line tool for validating RDF files?

I am looking for a substitution of the W3C RDF Validator, as it is broken, in addition I want something a bit more automated, such as a command line tool. I have been using xmllint for checking XML ...
1
vote
2answers
102 views

Egrep multiple strings in an XML file

I have a collection of XML files in a standard format that I'd like to search to see if they match two strings. Here is the idea: <ELEMENT1>Dave</ELEMENT> ...
1
vote
3answers
91 views

Use Unix tools to look for a definition block in an XML.

I am using an XML that has definitions in this form - <definition name="ticketOpen" extends="ticketUpdate"> <put name="title" value="Open Ticket" /> <put name="mainForm" ...
1
vote
1answer
1k 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> ...
1
vote
1answer
457 views

Parse JSON or XML on bootup

I'm compiling my own version of the linux kernel and I was wondering if there is any way to do parse a local XML or JSON file.
1
vote
2answers
535 views

Text processing: convert text of table of content into djvu bookmark format?

Usually in the table of content of a book, each line is for a chapter or section and ended with its page number, for example, 1 first chapter 10 1.1 first section 11 1.1.1 first subsection 12 1.2 ...
1
vote
1answer
30 views

How do I synchronize 2 xml files?

I have 2 xml files named 1k.xml and 1n.xml. The file 1k.xml contains some additional elements and data which are not there in 1n.xml. I want to copy whatever is absent in 1n.xml to it, so that both ...
1
vote
1answer
375 views

Split very big xml file into little pieces with specific line number count

This is how I did to extract the first 100000 lines from my big xml file (2gb): head source.xml -n 100000 > part.xml How can I keep splitting them to 100000 line (or specific file size chunks) ...
1
vote
2answers
162 views

How to remove nodes from a HUGE (>2gb) XML file?

I'm working with several huge (>2gb) XML files and their size is causing problems. (My application uses XMLReader in a PHP script to parse smaller ~500mb files, and that works fine, but XMLReader ...
1
vote
1answer
1k views

Alternative to xmllint to check xml validity

Sometimes, I have to check the validity of some big xml files against a xsd file. The biggest xml file I received had a size close to 1.5GB. xmllint took all my RAM and almost all the swap space, for ...
1
vote
1answer
31 views

Openbox Syntax Error in ~/.config/openbox/rc.xml [closed]

I added a new keybinding to my rc.xml and now I get this message every time I log into Openbox. Also, the right-click menu does not work anymore either. Now I would have fixed the error myself, but ...
1
vote
1answer
296 views

Convert XML to SQL INSERT statements using the command line

Is there a way to convert XML to SQL INSERT using the command line, here is examples: <something> <somthingelse>lol</somethingelse> </something> would be INSERT INTO ...
1
vote
1answer
187 views

Why isn't this XMLStarlet Query Working?

I'm trying to write a simple bash script that parses price info from the ebay developer API search results. Here's an example of XML search results for "Detective Comics 700": ...
1
vote
1answer
341 views

Parsing an xml RSS feed file

What I would like to achieve is to receive an email with the failures of my VPS. I tried to do that by downloading an rss feed XML file from my VPS provider which contains all the failures, down ...
1
vote
1answer
515 views

Modify XML file based on partial name

I've been using Xmlstarlet to modify some .xml files but I am lost trying to figure out how to modify a tag based on a partial name. What is the best way to comment out an entire line that begins ...
1
vote
1answer
5k views

XML parsing using xmllint and customizing the output

I have xml file (say input.xml) of the following schema: <?xml version="1.0"?> <TagA> <TagB> <File Folder="FOLDER1M\1" File="R1.txt" /> </TagB> ...
1
vote
1answer
249 views

show only tags of an xml document on the command line

Is there a command line command or utility I can use to show only the tag structure of an xml document? I looked at xmllint but I didn't see a switch to do it. For a structure like ...
1
vote
1answer
194 views

What editor can be used to provide highlighting for Mallard project files?

I normally switch between Geany, vim and Emacs (depending on my mood. LOL) when editing on a linux platform. Recently, I have begun exploring the Mallard Project, but have been unable to find the ...
1
vote
1answer
16 views

XML Microsoft Word Document

I have a .xml file generated by someone with MS Word and I cannot manage to open it with LibreOffice or other app or change its format. I tried to save a LibreOffice document as "Word 2003 xml" and ...
1
vote
1answer
26 views

Adding new attribute to existing xml file using sed or awk

I have a xml file which contains below details: <server> <mbean code="WSMQConnectionFactory" name="service=MQQueueConnectionFactory"> <attribute ...
1
vote
0answers
53 views

Can gedit highlight element of svg stucture?

Gedit can show matching parenthesis. Can it do the same with tags of an SVG file ? For example when I mark <text> I need to find closing </text> tag.
1
vote
1answer
137 views

How do I get a list of the values of matching attributes using xmllint and xpath?

I'm trying to use xmllint to parse names of Solr cores from the configuration file. This works: xmllint --xpath /solr/cores/core/@name solr.xml |grep -Po '(?<=name=")[a-z-]+(?=")' And it returns ...