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

learn more… | top users | synonyms

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: ...
1
vote
2answers
164 views

How to remove a line from a tag in shell script?

We have an xml file (abc_lop.xml) in which I need to remove a line which is present in a tag: Below is an xml file, I have shorten it down as it is very big. <HELLO version="4.2" xmlns="http://...
0
votes
5answers
3k views

How to grep an xml block in an xml file using a keyword in ksh

I have a file Sample.xml which contains a lot of services inside it and the structure looks like this Notes: I cannot use any XML parser tool as I don't have permission , read only My xmllint ...
1
vote
5answers
214 views

lines to columns with awk

I have to following sample output: <HARDWARE> <NAME>WIN1</NAME> <OS>Windows 7</OS> <IP>1.2.3.4</IP> <DOMAIN>contoso.com</DOMAIN> &...
8
votes
2answers
1k views

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

The Unix environment has some excellent tools for parsing text in various forms. However, of late, the data is not in the traditional (historical) formats (CSV, TSV, record-based or some other ...
3
votes
5answers
645 views

Efficient data extraction from multiple files to a single CSV file

I have a large collection of XML files with the same exact structure: $ cat file_<ID>.xml ... ... ... <double>1.2342</double> <double>2.3456</double> ...
2
votes
2answers
326 views

alter a line and remove tag using perl from xml file?

I have an xml file (client_23.xml) in which I need to alter one line and remove one whole tag from it so I came up with perl script: In my xml file, I have a block like this. There will be only one ...
1
vote
1answer
3k views

Confused about how to convert XML to CSV using xmlstarlet on OS X?

I asked a question earlier and it was closed as being a duplicate: How to parse XML to CSV with a shell script?. The answer in the duplicate that was linked suggested using a tool called XMLStarlet, ...
0
votes
1answer
245 views

Replacing all `&` but not the one in XML entity `&amp;` with `#` with sed in a given XML tag

I needed to replace all & with #, inside and only inside the <faultstring> ... </faultstring> tag. Additionally, the & in &amp; should not be changed. Sample input: 123&&...
0
votes
3answers
77 views

How can I escape special characters in a sed “sub-command”?

I'm using xmllint --shell on a large XML file, and using the write command to write out an XML snippet to be used in testing. The snippet that gets written out needs a couple of lines from the ...
0
votes
1answer
160 views

How to implement awk range pattern in fetching an xml block when the input parameter is in the middle of the block

I am trying to fetch an xml block like this: <machine name="sample1" min="1" max="10" idleTime="300" backend="ABC,XYZ"> <handler className="com.abc.xyz.qwerty.foo.FooBar" /&...
0
votes
1answer
5k views

How to parse XML to CSV with a shell script?

What is the ideal way to parse an .xml file into a .csv file that I could include with my shell scripts. I know bash cant do it but I'm unsure if I should try in awk or sed. I imagine a language ...
0
votes
2answers
48 views

Remove string with > and forward-slash from xml code

I want to remove two strings globally from some xml code. They are: </sellingStatus> and <sellingStatus> I have tried the following unsuccessfully: sed -i 'sed -i 's/</...