Questions tagged [xml]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
24 views

search of .xml files without certain tag through mac os terminal

I would appreciate having your advice on the below. Having a folder name "ABC" with thousands of .xml files inside. The core structure of XMLs is the same: <product abcd…> <...
0 votes
3 answers
39 views

How to get all numbers AND IPs from string using regex?

Let's say I have the following example string: <ETH0_IP><![CDATA[10.0.100.10]]></ETH0_IP> I would like to extract the first number and the IP in the following format: 0 10.0.100.10 ...
  • 382
0 votes
3 answers
35 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
1 answer
16 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>...
  • 179
4 votes
2 answers
448 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 ...
  • 1,799
2 votes
1 answer
61 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 ...
  • 77
3 votes
1 answer
232 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 ...
  • 77
2 votes
1 answer
799 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 ...
  • 77
-1 votes
1 answer
76 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:...
  • 1
-1 votes
2 answers
230 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/...
-2 votes
2 answers
91 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 ...
  • 11
0 votes
1 answer
66 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
35 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="...
  • 11
0 votes
5 answers
470 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....
  • 429
4 votes
4 answers
816 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 ...
's user avatar
0 votes
1 answer
373 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 ...
  • 3
-1 votes
2 answers
77 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 ...
4 votes
3 answers
638 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</...
  • 43
0 votes
0 answers
15 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
31 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 ...
0 votes
3 answers
232 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
77 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 ...
  • 7,703
0 votes
2 answers
64 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; &...
  • 677
0 votes
4 answers
157 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=...
0 votes
2 answers
133 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<...
  • 1
2 votes
2 answers
389 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: <?...
0 votes
1 answer
677 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
362 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
126 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. ...
  • 437
0 votes
2 answers
86 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
114 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-...
  • 437
0 votes
4 answers
2k 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-...
  • 509
2 votes
1 answer
220 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 ...
  • 221
1 vote
1 answer
130 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=&...
  • 1,607
3 votes
2 answers
157 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</...
  • 246
-2 votes
2 answers
72 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</...
-1 votes
3 answers
95 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
58 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 ...
  • 333
3 votes
4 answers
866 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 ...
  • 333
4 votes
2 answers
585 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 ...
  • 14.6k
2 votes
3 answers
871 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> &...
0 votes
1 answer
78 views

Search&replace closing tag after matching starting tag+any content inside in XML

I'm trying to find the solution for search and replace in WordPress export XML file that will: find string <content:encoded><![CDATA[HERE GOES ANY POSSIBLE POSTS TEXT including HTML tags]]&...
  • 3
2 votes
3 answers
170 views

Picking up the DB name in a line of a config file

I have this jdbc file line <url>jdbc:oracle:thin:@192.168.1.70:1521:MYDBORA</url> I need to use some kind of utility to catch the MYDBORA part but it is not always the same name. I need ...
  • 47
2 votes
3 answers
319 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=...
3 votes
2 answers
1k views

reading XML file and extract only node names and structure

I need to audit XML file structures and need to generate a report that shows only the DOM tree structure and omit the values. Essentially, I just the node names only and no values. I tried using ...
  • 31
0 votes
1 answer
37 views

How to use the special character < for assigning shortcut-keys in openbox config file?

According to https://stackoverflow.com/a/1091953/ five characters need to be escaped in XML documents under some circumstances: " &quot; ' &apos; < &lt; > &gt; & ...
  • 173
0 votes
1 answer
37 views

Refining Saxon outuput

As a follow-up to this question, I now have the following command: set +H && java -cp saxon-he-10.5.jar net.sf.saxon.Query -config:saxon.xml -s:rss.xml -qs:'//item/link!substring-after(., &...
  • 139
1 vote
3 answers
375 views

How can XPath functions be expressed to output each input element?

I'm using this command: xmllint --xpath 'substring-after(string(//item/link), "_")' rss.xml And get the desired output, except it's on the first element. How would I fix this to have it be ...
  • 139
1 vote
1 answer
293 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
1 answer
176 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 ...
  • 101

1
2 3 4 5
9