Questions tagged [xml]

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

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

I need a bash script that replaces every number between two arrows in a file with a 0

the name of the file is types.xml and lists hundreds of different items. this is what it looks like: <type name="CanisterGasoline"> <nominal>50</nominal> ...
0 votes
2 answers
173 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
1 answer
13 views

How to display only the content between opening and closing tags in XML file?

How to search the XML file using grep or similar for a particular tag but show only the content between opening and closing tags? Here is the exact tag I'd like to locate: <max-diskusage>...
4 votes
2 answers
186 views

Deleting an XML tag in a huge file

I have difficulty parsing a huge XML file (about 100GB with large nodes). I am trying to reduce the node sizes by deleting unnecessary tags. For example, any <text> tags. If I use native XML ...
3 votes
4 answers
38k views

create XML file using bash script

I want create simple xml file using bash script ( not with dom ) but when I set value in the line then echo print the $lorem word and not the val lorem=LOL echo '<root><foo a="b">$...
2 votes
1 answer
51 views

How to untag, in an XML file, a chain of tagged characters that are embedded within specified tags

What is the xmlstarlet command to untag, in an XML file, a chain of tagged characters that are embedded within specified tags? Example: searching every occurrence of the tag <b>, that needs to ...
3 votes
1 answer
121 views

How to rename, in an XML file, specific tags that are embedded in some other specific tags

What is the xmlstarlet command to replace a tag value by another one, only for specified tags embedded in other specified tags? Example: searching every occurance of the tag b, that needs to be ...
2 votes
1 answer
134 views

How to replace, in an XML file, specific strings of characters in some specified tags with other strings of characters embedded in tags

I need to replace, in an XML file, specific strings of characters in some specified tags with other strings of characters embedded in tags. Example searching every occurance of an example, that needs ...
0 votes
4 answers
863 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 &...
-1 votes
1 answer
37 views

How to parse the xml start tag to end tag using shellscript?

I have XML file like below, called sample.xml: <m:properties> <d:>ABCD</d:> <d:>1234</d:> <d:>0048</d:> <d:>0.0</d:> </m:properties> <m:...
0 votes
5 answers
156 views

Replace hyphen(s) with underscore(s) within angle brackets in a file

I’m aware of how to replace string; e.g., replace hyphen with underscore in a file. However, I wish to replace all hyphens with underscore for all text that falls within angle brackets in a given file....
-2 votes
2 answers
65 views

I need to update a tag <abc><\abc> with variables from another file. Output should be an xml file with all those values comma separated within abc tag

I need help updating an xml file, file1.xml which has a tag name <abc> <\abc>. The file2.txt has numbers fixed length numbers (1 number in each row): 1234 5678 1435 I need output to a ...
1 vote
1 answer
3k views

Posting to socket using curl

I'm struggling to get curl and socat to play nicely together. The situation is the following: I post XML to login to a system. Return message contains authentication token. I post subsequent requests ...
-1 votes
2 answers
128 views

Change the value of an XML tag using awk or sed

So I have an XML file <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/...
-1 votes
5 answers
11k views

script to translate xml to json

I have 5000 questions in txt file like this: <quiz> <que>The question her</que> <ca>text</ca> <ia>text</ia> <ia>text<...
0 votes
1 answer
40 views

Insert line after an XML file

I have a file that contains a small XML snippet. I also have a large XML file. The large XML file has a line that includes <build>. In Bash, How can I insert the contents of the small file after ...
-1 votes
1 answer
34 views

Change the version number from 97 to 98 in an XML file [closed]

I want to change the version number with respect to the ip. For example for this ip 10.228.134.226, it should change the version number from 97 to 98 <qa:browsers> <browser name="...
4 votes
4 answers
806 views

Extracting sea level pressure from KML using Shell

I'm currently working on a little project; in a kml file called weatherdata.kml, I would like to extract the sea level pressure for each <Placemark> element. I'm trying to parse the information ...
0 votes
1 answer
144 views

replacing value in xml file using sed value from variable missing ""s

hi can some one please help me here i am trying to replace value in tomcat server.xml file username using sed command <Resource username="user1" password="xxxxxxxx"/> below ...
-1 votes
2 answers
63 views

Counting TAB/SPACES before a particular line

I have a requirement in which I need to identify a field in a file, If found than I will have to add a new line and add some text. But I want to count the number of SPACES before the word found so ...
0 votes
2 answers
69 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:...
4 votes
3 answers
427 views

Using sed to replace one character with another within an xml tag

I need to replace the character S with T in: <episode-num system="onscreen">S1 E12</episode-num> The result I expect: <episode-num system="onscreen">T1 E12</...
1 vote
2 answers
429 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
0 answers
13 views

xsl:apply-imports for beginners?

I am using XSLT 1.0 against my XML files for testing the values inside the xml files in linux box. I came to know about xsl:apply-imports and quickly went through some of the websites. I am finding it ...
0 votes
0 answers
24 views

xsltproc not supporting path cmdline argument?

I am using xsltrpoc for XSLT 1.0 stylesheets in linux box. I am using XSLT against my XML files. I need to import one file say base.xsl to my file say main.xsl. I realized to use the xsltproc --path ...
5 votes
4 answers
694 views

Can I convert fields in XML to tags using xmlstarlet?

I want to convert fields in Tags to tags within that tag for example <book name="Data Structure" price="250" pages="350"/> to <book name="Data Structure&...
0 votes
3 answers
125 views

Change the format of a XML string which have date timestamp in the middle inside a lot of text files in the same folder (*.txt)

I have a lot of text files with dates in XML formated as follows: <DATA2020-04-13T08:59:05.427 /> Need to change into this: <DATA>2020-04-13T08:59:05.427</DATA> Notes: The date and ...
0 votes
1 answer
50 views

ABRT complains about failure of /usr/sbin/setroubleshootd

On a CentOS 7 machine, I get: ABRT has detected 1 problem(s). For more info run: abrt-cli list --since 1641301975 [root@my_machine ~]# abrt-cli list --since 1641301975 id ...
0 votes
4 answers
144 views

Problems with replacing XML tag contents using sed

I have the following XML piece: <value id="1" creatorId="0" creationTime="1639487132" expirationTime="1639573532">+380554446363</value> <value id=...
2 votes
2 answers
211 views

Find a pattern (of a child tag) and replace the entire parent tag at XML files, without using sed tool [duplicate]

Is there a way to find a pattern (of a child tag) and replace the entire parent tag, using regular expressions?  I'm working from a Linux server without a graphics environment. I have XML like: <?...
2 votes
6 answers
2k views

Replacement of XML based on attribute content using sed

I've got to replace some attribute content in an XML tag, depending on a parameter $1. We've got in input, for example: <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="OO ...
0 votes
2 answers
52 views

Sed an XML balise

Please, I have this xml balise inside my test.xml file <ingressAnnotations>nginx.ingress.kubernetes.io/server-snippet: | location @custom_503 { return 503 &quot;&lt;html&gt; &...
0 votes
2 answers
68 views

extract all XML tags and values

I have this long line: <hdr><name><first>John</first><mid></mid><last>Smith</last></name><dob>04181995</dob><phone>5550001111<...
4 votes
2 answers
1k 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 <tag1><...
0 votes
1 answer
226 views

Retrieving value of XML tags

I have an xml file like below: <FileHeader>SampleFile</FileHeader> <Name>aaaa</Name> <Place>bufnkf</Place> <Name> bjfbhj</Name> <Place>bvdhbf</...
0 votes
4 answers
207 views

How to remove text between two keywords in a textfile

Context : GNU/Linux Ubuntu. I've a file made of thousands of lines and I'd like to have a script that will remove some lines between 2 specific keywords. Initial file is like: bla bla ... bla bla ...
0 votes
1 answer
71 views

xmlstarlet command for batch processing .xhtml files

I've tried xmlstarlet for processing an individual .xhtml files. xmlstarlet fo --omit-decl --recover --html file.xhtml This command process an individual files and prints output on terminal only. ...
0 votes
2 answers
67 views

How to extract few tabs from a xml file using zgrep or sed

I have a big size file like 5GB with .gz. Inside that file, we have few XML files that contains values that I want to search and extract just in case if those values are there. For example I want to ...
1 vote
0 answers
72 views

XMLstarlet to fix image tags and replace path for images

I have multiple .XHTML files in the folder. The top declaration part is as follows: <?xml version="1.0" encoding="UTF-8"?> <html xml:lang="en-us" lang="en-...
0 votes
4 answers
1k views

How to extract a portion of an XML tag value in a Bash script

I have a XML file like this (A.xml) : <?xml version="1.0"?> <RunParameters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
1 vote
1 answer
74 views

How to keep double quotes in a bash execution inside sed

I have a log file containning a lot of line like this: 2021/09/03-13:11:05;QUEUE.INBOUND;4;ID:myhost.mydomain.net-7756-1629822315072-199:973:1:1:1;MISC;"<?xml version="1.0" encoding=&...
2 votes
1 answer
190 views

How to add closing XML tags with sed

I have the following example in the XML doc: <meta name=Originator content="text/html; charset=iso-8859-6"> <meta name=ProgId content=Word.Document> <meta name=Generator ...
3 votes
2 answers
153 views

Arrange code blocks sections based on dates and months

I have a file with repeated contents like this; <item> <date>August 24, 2021</date> <p>Text</p> </item> <item> <date>February 11, 2020</...
-2 votes
2 answers
68 views

How to print last_name as well in .txt file?

I have this file on a Linux machine: <names> <first_name>Mohammed Sani</first_name> <last_name>ABACHA</last_name> <aliases> <alias>ABACHE,Mohammed Sani</...
3 votes
4 answers
816 views

sed regex fails to capture the entire paragraph containing the pattern

I have this XML file (example) <This is a line of text with a year=2020 month=12 in it This line of text does not have a year or month in it This year=2021 is the current year the current month=1 ...
-1 votes
3 answers
93 views

Finding element of file in KSH

please help me figure out what I am doing wrong. I have this file called "res.xml" <sequence type="a"> <transaction> <branchSerial>1</branchSerial> &...
-1 votes
2 answers
57 views

sed command succesfuly find and replace in file , bit erasing everything in the new file

i have this xml text in file named test2.txt <This is a line of text with a year=2020 month=12 in it This line of text does not have a year or month in it This year=2021 is the current year the ...
4 votes
2 answers
509 views

Find XML file with specific path

I'm working with XML files, each of which could be dozens of lines long. There are literally hundreds of these files, all over a directory structure. Yes, it is Magento. I need to find the file that ...
2 votes
3 answers
269 views

I need to use sed in Linux to find a portion of a line in XML and update a value in it?

I have a requirement to update a variable value in XML with a fixed value once there is a partial match in XML using sed on Linux. Example: Input value: <Table tableName="Data" primaryKey=...
2 votes
3 answers
701 views

Sorting an XML file in UNIX with a Bash script?

I am trying to sort my XML file that looks like this by alphabetical order. This is a part of a larger bash script so it needs to work within that script: <Module> <Settings> &...

1
2 3 4 5
9