Questions tagged [xml]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
44 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
12 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
27 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
33 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
42 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
34 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
21 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
277 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
88 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
50 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
42 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
43 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
22 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
57 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
56 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
96 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
72 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
42 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
48 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
60 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
50 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 ...
0
votes
0answers
75 views

Run a new nmap based on masscan XML output

I'm scanning a entire network with masscan (because it is faster than nmap) and outputing to XML. There is a way to start an nmap based on the XML output? The idea is: Masscan scan the entire network ...
1
vote
3answers
286 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
37 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
279 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
16 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
892 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
109 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
23 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
222 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
55 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
522 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
225 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
268 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
696 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
39 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
233 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
406 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
600 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
41 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
191 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
257 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
61 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 ...
2
votes
3answers
176 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
2k 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" /&...

1
2 3 4 5
8