Questions tagged [xml]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
24 views

Update XML parameter, with namespace, using xmlstarlet

I have this XML file: <?xml version="1.0" encoding="UTF-8" ?> <engineConfiguration xmlns="http://bla.com/engine/management/engineConfiguration"> <...
0
votes
1answer
19 views

xmlstarlet how to select tag immediately before selected tag

I scan scribus SLA files and wish to find the text having some specific paragraph styles. SLA file format is a quite flat XML format and there are several paragraphs in a row, each being separated ...
4
votes
6answers
646 views

How to find a specific tag section in an XML file?

The last few lines of my file /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml: <schemalist> <schema> <!-- some other tags --> <key name='notify-on-connect' type='...
2
votes
4answers
186 views

How can I remove duplicated tags based on specific attribute name in an XML file?

How can I remove duplicate line based on "groupName" and keep the line with directoryId="1"? <Group id="123" groupName="ABC" lowerGroupName="abc" ...
0
votes
0answers
8 views

Embed arbitrary structured metadata (key-value pairs or XML) into PDFs with XMP?

I have a process that generates PDF files from a source, and another that generates metadata about the same source in XML format. The metadata is structured (multiple levels of elements, innermost ...
0
votes
1answer
48 views

Extracting text from an xml file

If I have an xml file containing entries like this <root> <d:entry d:title="OYSTER"> <span class="foot"> <span role="text"> foo&...
0
votes
3answers
56 views

Trying to read XML attributes from multiple files and replacing them with a number 1.25 times greater than they were before

I am trying to write a bash script or something similar, that I can use to modify all occurrences in a bunch of xml files with one click. I have 24 xml files, each containing a few dozen lines and ...
0
votes
0answers
13 views

Limit libvirt lxc container filesystem size

I'm running an lxc container through libvirt. First I've created a container with lxc-create -n test-container -t download -- -d ubuntu -r focal -a amd64 Then I create a new virsh guest with virsh -c ...
1
vote
1answer
29 views

AIX - Using Sed To Replace A String In A File

On RHEL, I am able to utilize the sed -i command to replace a string within a file, however, on AIX, it seems like the same -i parameter cannot be used. I have a file called abc.xml that contains the ...
0
votes
1answer
45 views

Bash script to parse XML color file

I have an XML color file that I want to transform to a Kotlin equivalent. Given this input file colors.xml <?xml version="1.0" encoding="utf-8" standalone="no"?> &...
0
votes
1answer
64 views

How to filter multiline with awk, grep and/or powershell

My scenario is I have a file that has the contents looking like this but longer. https://pastebin.com/q33wFdAX I need to remove each occurrence of <category>Games</category> </...
0
votes
2answers
38 views

How do I replace a certain pattern in multiple files?

My goal to update version number in multiple XML file like following <?xml version="1.0" encoding="UTF-8"?> <Component xmlns="http://soap.sforce.com/2006/04/metadata&...
0
votes
0answers
24 views

Removing malformed elements in XML file using bash script

I have been querying large numbers of records from a database which returns the records in XML format. Occasionally, query errors will cause malformed records to be written which take the form of ...
3
votes
2answers
292 views

Shell script to remove child xml tags conditionally

I have a xml file having following content. <contracts> <clients> <client> <name>Nicol</name> <clientRef>123</clientRef> ...
-1
votes
2answers
85 views

Match the pattern and if the pattern is found then comment the tag based on line number

I have the input XML file which looks like below INPUT XML FILE <Formula> <Name>Total Hate Fee</Name> <Code>1234> <Job>BO</Job> <Type>sub</Type> </...
-2
votes
2answers
99 views

sed giving me this error: … unknown command: `

I have code which will replace the xml tag at a particular line number LineNum=`grep -n "Deep" file.xml | cut -d: -f 1 | awk -F '[\t]' '{$NF = $NF -1;}1'` sed "${LineNum}s#^<...
0
votes
1answer
52 views

Getting syntax error exception for “expr”

I have an xml file which looks like below INPUT XML FILE <ReconSummary> <entryName>Total Deep</entryName> <Code>777</Code> <License>L</License> <Tran>...
-2
votes
1answer
45 views

Replace Tag of and xml file after pattern matching using shell

I have an input xml file like below INPUT FILE <ReconSummary> <entryName>Total Deep</entryName> <Code>777</Code> <License>L</License> <Tran>H20</Tran&...
0
votes
2answers
46 views

search and replace with sed special character

I need to perform search and replace using sed. starting from this sample text for example : <TextView android:textSize="20.0sp" android:...
0
votes
1answer
31 views

xmlstarlet select iteratively multiple occurences of same tag

I am trying to select attribute values within multiple occurrences of same tag using xmlstarlet within a for loop ,but the $i in the iteration is not taking value as expected , I am referencing it as &...
1
vote
2answers
61 views

awk: change line to itself parsed with command. Multiline text

I'm trying to answer a question. It involves using the command recode. A specific line has to be parsed by the command leaving the rest untouched. The file is an xml file. Example: <ITEM_ID>...
-2
votes
1answer
57 views

sed XML parse select text between tags with special characters while deleting other blocks

I am trying to parse an XML which consists of blocks between <JOB> and </JOB> , I am parsing within a do while loop , while reading the block between <JOB> and </JOB> , I am ...
1
vote
2answers
181 views

Use xmlstarlet to remove an entire element that matches an attribute value?

My question is similar to sed - Delete XML node containing certain element - Unix & Linux Stack Exchange. Trying to implement the suggestions there has kept me busy all day, but I haven't managed ...
0
votes
1answer
82 views

How to locate a file created through the eXist-db database tool eXide?

I'm trying to find a specific file: note.xml which eXide would seem to have saved. Where is it? I've tried: sudo find / -iname \*.xml | grep note and a few varieties. Perhaps it's not "saved&...
0
votes
1answer
44 views

How to extract specific node values without travesing via xmlstarlet

<xml> <email>asdadw@cutshort.io</email> <email>sadfasd@cutshort.io</email> <email>asdas@cutshort.io</email> <host> <ip>56....
-1
votes
1answer
57 views

How to extract mutliple text lines within xml file by using grep and/or sed

I am trying to extract some lines within a <w:t> tag in front and </w:t> tag at the end of the text I want, but im only getting the text within last tags and not the others. How can i do ...
1
vote
1answer
63 views

Awk File processing to get last processed weekday

My application which does processing based on input XML's, processes the input files and adds the status to status_file.txt after processing. I am writing a script to identify the last processed day ...
1
vote
3answers
56 views

Variables inside heredoc with multiple files

I have a heredoc with xml content, and I add the content of another file like this: bar file: <bar> $baz </bar> the script: bar=$(cat bar.xml) # this would be the ideal, of course it ...
1
vote
3answers
367 views

how to search and replace PATH element with SED of xml file in bash

I would like to replace the current element inside example path tag from: ... <examples> <example path='/test/test123/test12345.txt'/> <examples> ... to ... <examples> <...
1
vote
0answers
42 views

Identify empty VALUE in XML files and return exit command? [closed]

For instance, I have an XML file with the below content and the "NAME" Author and Assignee(s) have empty "VALUE". The main aim is to implement a check that can be applied to find ...
3
votes
6answers
311 views

Using sed to replace substrings between specific tags

I want to combine two sed command in one and really don't know how to do it, I've tried multiple things without success. For the result I want all slash between a specific tag to be replaced with ...
-1
votes
1answer
44 views

How to find and replace string having numbers with another string having number

I have an xml tag like <bestAddressLine4></bestAddressLine4>. I want to convert that to <bestAddressLine4 /> I am using below command but it is not working. sed -i 's/<...
0
votes
0answers
18 views

pdf with form and send mail button that does not work in gnome

I have this pdf form to be filled anytime I need an additional and temporary worker in my restaurant (for example, an additional waiter). The PDF has been created by the government working agency and ...
1
vote
5answers
1k views

How to insert a newline character after each occurrence of a specific XML tag in a file?

How to insert a newline character after each occurrence of a specific XML tag in a file? My file has multiple tags </Data> and I want to insert a NewLine character after each </Data> tag I'...
0
votes
3answers
127 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> &...
1
vote
0answers
25 views

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

Given the following freedesktop shared-mime-info file: <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info&...
0
votes
3answers
284 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
61 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>&...
2
votes
3answers
648 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
2answers
257 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
305 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
829 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
42 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
85 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
268 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
35 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
464 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
668 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
43 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
216 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" ...

1
2 3 4 5
8