Questions tagged [xml]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
26 views

Read a word in XML between elements using sed command

I want to read a word between two xml elements using sed command. For e.g. in below xml, I want to read the number 1234567. <ns1:account> <ns2:name>Corporation</ns2:name> &...
0
votes
0answers
10 views

Is it possible to require both glob and magic specified in mimetype definition?

Given the following: <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type=&...
0
votes
3answers
31 views

Find xml tag and replace the text inside the tag to a parameter value multiple occurrences

Find a specific xml tag and replace the text inside tags to some parameterized value. Multiple occurrences need to be replaced. Sample file content: <a>abc</a> Current attempt: sed -i &...
0
votes
2answers
47 views

sed XML Starting from line x, return the line number of the next occurence

I am deleting sections of tags from an XML and need to find the end tag to stop at. Example XML <SearchPattern> <something></something> </SearchPattern> <OtherTag>&...
1
vote
3answers
51 views

sed remove lines in range

I have an xml file. I am trying to remove only the blank lines from a range of lines. In this example I want to check lines 55-57 and remove any blank lines. This needs to be done in a shell script ...
0
votes
1answer
17 views

How to install BaseX on CentOS?

How do I install basex on CentOS? [nsaunders@rolly ~]$ [nsaunders@rolly ~]$ sudo yum install basex Last metadata expiration check: 0:16:02 ago on Mon 15 Jun 2020 05:19:44 PM PDT. No match for ...
2
votes
2answers
45 views

Removing spaces and double quotes between XML tags

I would like to remove spaces and quotes from the value of XML tag <ns:tag2> in my XML file on Linux(spaces to be removed only for this tag not other places). Sample XML content looks like ...
1
vote
3answers
92 views

How to comment out contents in xml file using sed?

I am creating a bash script to setup tomcat server. I need to comment some contents from context.xml file. I tried with sed but not able match the contents. Here is full context.xml file: <?xml ...
0
votes
2answers
31 views

Replace underline in multiple XML files

In a directory with several XML files (there may be hundreds of files) I have a field called <import_url>. In this field it can happen that a URL has an underscore. I would like this underscore ...
0
votes
4answers
74 views

XML Data to CSV

Need some quick help as I am not able to get the desired output: 2020-05-19 19:03:07,135 INFO [Container : 8504] [HttpUtil.java]requestXML: <?xml version="1.0"? ><COMMAND><TYPE>...
0
votes
3answers
71 views

How to extract specific string from web url using sed command with curl command

Using Linux server I have a URL which generates the below data: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="/seriessnapshot.xsl"?> <timeSeries> <series ...
0
votes
1answer
27 views

Linux remove a occurrence of sentence from a file and add add start and end

I have a script that curl a command to sms gateway to send sms and get xml as response. Each response are appended to a single file for future xsltproc process for creating csv. A single response is ...
0
votes
1answer
42 views

How to convert curl response xml to plain/csv/xls for a total count

I have a script that send sms for a trigger using a sms gateway. The command to send sms used is curl as below: curl 'http://www.example.com/push/server.php?user=******&pass=*******&sid=******...
2
votes
5answers
81 views

Replace text in file with multiline string

I have an XML file containing, amongst other lines, <asd>blablabla</asd> and <dsa>-some stuff -other stuff final stuff.</dsa> I want to replace everything between the "asd" ...
0
votes
1answer
22 views

How to Search XML Block and Delete the same

This is my XML. <configGroup> <type>SERVER_CONFIG</type> <configProperty id="Server48"> <configProperty> <name>Server Name</name> <...
0
votes
1answer
40 views

I want to add a namespace prefix to the tags of the default name space of an XML document from the shell

I have a SVG file, which is an XML document: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" ...
0
votes
1answer
29 views

Split file based on beginning and end XML tag

Can split be used to split a file into multiple segments where the size of each segment is based on the number of matches of an XML element ? For example for below XML split when encounters of "<...
-1
votes
3answers
39 views

Insert lines after character

I have data in a long lined file example: <currency>USD</currency><amount>111</amount><amountf>111/amountf><recv_confirms>2</recv_confirms><fee>22&...
1
vote
1answer
34 views

Reading .xml files and writing out the information in a .txt file

I want to download river runoff (.xml) files from a ChartServer online and create a .txt file with the information by running a .sh script. But I'm having difficulty in getting the data out in the ...
0
votes
0answers
31 views

How to set while loop and define xml output as a condition to stop the loop from running?

I've been digging through a lot of feeds online for the past few days and I've found bits and pieces of what I'm trying to accomplish, but since I am very basic with scripting and xml I got stuck. I'...
2
votes
3answers
171 views

Fetching the string inside single quote

<source file='/home/anpham/Projects/vm-builder/30G'/> I tried to use sed command to extract the absolute path from the output above but the output doesn't trim the string. The following ...
0
votes
2answers
229 views

Reading XML and extract only value [duplicate]

What is the easiest way to extract just the value set in a XML file? For example the data in the XML file is <node name="host"> <map> <entry key="cipher_strength" value="low" /&...
0
votes
0answers
8 views

Extracting XML forming a resultset like format

I've encountered a case wherein I need to extract values from xml however, the tags are missing. To elaborate, I've manually finger-counted around 5 of the same elements however, one sibling node(...
2
votes
0answers
27 views

How to download media content from XML feeds

For the past few years, I've been using Newsboat for to follow RSS feeds with text, and a web-based RSS reader for feeds with images/videos/gifs. However, I'd like to bring all of my RSS feeds over to ...
0
votes
1answer
60 views

xmllint usage - having a hard time getting xml attributes

I'm in the process of retreiving some data from a xml file, it is actually a SSIS package file (dtsx). I've read about using xmllint, however I'm having a hard time retrieving what I want. I'd like ...
0
votes
0answers
6 views

Consolidate and sum EDI-like XML

I need an XSL that will sum amounts based on tag value until sequence ends. The data is EDI-like so records are tagged rather than hierarchically grouped. Take the following input as an example. &...
1
vote
3answers
204 views

Script to grep xml file and redirect output to files based off results

So i'm trying to write a simple script that'll parse a xml file and redirect output to a new file based off the name of the category it was found under. For example this is what the XML file looks ...
0
votes
2answers
36 views

Unix sed output coming pattern twice in replace

I've an XML file logback-spring.xml. Now, I want to replace string DEBUG with TRACE, wherever ref="logstash" occurs only in the next line. The input file looks like below: <logger name="com....
0
votes
1answer
58 views

insert a line into xml using xmlstarlet

I have an XML file which looks like so: <?xml version="1.0" encoding="UTF-8"?> <!-- Solr managed schema - automatically generated - DO NOT EDIT --> <schema name="default-...
0
votes
1answer
36 views

Regex groups not greedy?

Are sed matches always greedy? I am trying to use sed to append an XML comment into an XML file as early as possible, which is right after the XML declaration if there is one. Something like this, ...
0
votes
2answers
52 views

Structured data format to XML

I have some output in some structured data format that I need to convert into XML. My use case is that Palo Alto firewalls deliver configuration output via the command line interface which cannot be ...
2
votes
5answers
130 views

How can I extract strings from one file to insert (modified) in a different file?

problem is the following: I have an xml file with data and I am looking for a small part of the data to write it into a new file: content has been shortened by request: snippet if type=dhcp-client: ...
2
votes
3answers
49 views

How to sanitize XML attributes values

I have the XML like this: <string name="foo-bar">"bar-bar -bar"</string> <string name="asdf_qwe-rty" translatable="false">"Lorem ipsum"</string> Now, the name attribute can't ...
3
votes
1answer
410 views

How to remove nodes from XML file as command line?

I have an xml file that contains the tag </w:rPr> several times. It is used like this <w:rPr><w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/></w:rPr> However ...
-1
votes
2answers
80 views

how to append a line alignment with its previous line in linux?

I have many xml files. There is a line end with </autoReferenceLines>. The line may have different leading spaces in different files. I want to add a new line below that line with the same ...
0
votes
1answer
76 views

Ampersand problem in an xml file using shell script

I have an xml file which contains below <SummaryRecordMapping> <eName>Licensed Original MC TPE EXCESSIVE AUTH</eName> <jobs> <job> <SummaryRecordMapping> <...
0
votes
1answer
47 views

Variable not resolving in multi line string assignment

I'm trying to create a shell script which gives a Json block which is used further. The Json block consists of the dynamic components assigned as variables. Below is the code snippet failCount=$(cat ...
-2
votes
3answers
46 views

How can I extract a number of rows from a very big file from a known position? [closed]

I have a huge .xml file that weights 500Mb and I want to extract some text from it starting from a known position that I can grep. When I just do grep it shows me where the keyword occurs, but it ...
1
vote
2answers
44 views

extract values between 2 strings

I wanted to extract the values between entitlement <?xml version="1.0" encoding="UTF-8" standalone="yes"?><HorizonResponse><assignedDevices><assignedDevice><deviceType>...
1
vote
1answer
104 views

how to extract a specific value from an XML file, the value after the XML tag; (ex.after = sign?)

I have a file which has ReferenceId="0128140321960O" and also RelatedReferenceId="SWCC" <FinancialTransfersInstruction xmlns="middleware.frk.com/Schemas/Onetis/1.0"> <SWIFTHeader ...
0
votes
1answer
43 views

Script to remove all modules in pom.xml except the one with the highest number

Question I have a huge pom.xml from a Talend DI/ESB project, where it was possible to have multiple lines for the same module with different Talend specific versions (don't even ask for that :-( ) ...
0
votes
0answers
16 views

Empty tag addition using UNIX

My input xml data <financial-details><financial-detail><bucket-name>abc</bucket-name><bucket-transaction-type>PLACEMENT</bucket-transaction-type><transaction-...
0
votes
4answers
271 views

how to remove New line character using Sed or perl [duplicate]

I have a huge file of XML data containing the lines like <fonts> some of the data </fonts> <fonts> some of the data </fonts> <fonts> some of the data </fonts> <...
1
vote
0answers
77 views

Tool to convert multi-document YAML to XML

Are there any command-line tools to convert YAML to XML? I've seen that there are several websites that offer YAML to XML conversions, however none of them seem to support YAML files containing ...
1
vote
3answers
105 views

Linux sed regex escape

I use sed -i to replace the port value in a xml file, <property name="port" value="8954" /> But I don't know how escape the regex, my regex is below. (?<=name="port"\s+value=")\d+(?=") ...
0
votes
1answer
426 views

how to parse the xml that have multiple properties and names

if we are having a XML script like this , How to get the value of a particular name using XML parsing <?XML> <conf> <prop><name>something</name><value>1</value&...
1
vote
1answer
136 views

How to find max value from specific XML element using a Perl one liner?

I have an XML file with the following syntax <element> <id>0</id> <tag1>something</tag1> ... <tagn>something</tagn> </element> <element> ...
-1
votes
1answer
66 views

To get the value of specific attribute value as True or False, having uneven columns [duplicate]

I am having one file with the below two lines in the file. I need to check if the value of xpoweredBy is true or false. Many thanks in advance. <Connector clientAuth="false" sslProtocol="TLS"...
0
votes
1answer
40 views

Add some text after the 4 lines of the matching pattern using shell

I have a xml input file which contains below INPUT FILE <Formula> <name>Total Invoices Released</name> <comment></comment> <sumType>Suspense</sumType> <...
0
votes
1answer
13 views

Using XSLT to create elements where there are no corresponding elements as hooks

I have a long HTML table that I am transforming to XML and breaking up into sections. Abbreviated source: <html> <head> <title>Sample doc</title> </head> <body> &...

1
2 3 4 5
7