Questions tagged [xml]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
43 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 ...
user avatar
  • 77
3 votes
1 answer
99 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 ...
user avatar
  • 77
2 votes
1 answer
67 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 ...
user avatar
  • 77
-1 votes
1 answer
28 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:...
user avatar
  • 1
-1 votes
2 answers
114 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/...
user avatar
-2 votes
2 answers
59 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 ...
user avatar
  • 11
0 votes
1 answer
38 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 ...
user avatar
-2 votes
1 answer
33 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="...
user avatar
  • 11
0 votes
5 answers
89 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....
user avatar
  • 297
4 votes
4 answers
797 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 ...
user avatar
0 votes
1 answer
69 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 ...
user avatar
  • 3
-1 votes
2 answers
62 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 ...
user avatar
4 votes
3 answers
337 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</...
user avatar
  • 43
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 ...
user avatar
0 votes
0 answers
22 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 ...
user avatar
0 votes
3 answers
91 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 ...
user avatar
0 votes
1 answer
38 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 ...
user avatar
  • 7,249
0 votes
2 answers
43 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; &...
user avatar
  • 657
0 votes
4 answers
142 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=...
user avatar
0 votes
2 answers
53 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<...
user avatar
  • 1
2 votes
2 answers
141 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: <?...
user avatar
0 votes
1 answer
97 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</...
user avatar
0 votes
4 answers
140 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 ...
user avatar
0 votes
1 answer
60 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. ...
user avatar
  • 437
0 votes
2 answers
60 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 ...
user avatar
1 vote
0 answers
57 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-...
user avatar
  • 437
0 votes
4 answers
799 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-...
user avatar
  • 499
2 votes
1 answer
175 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 ...
user avatar
  • 211
1 vote
1 answer
60 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=&...
user avatar
  • 1,545
3 votes
2 answers
151 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</...
user avatar
  • 244
-2 votes
2 answers
66 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</...
user avatar
-1 votes
3 answers
92 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> &...
user avatar
-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 ...
user avatar
  • 313
3 votes
4 answers
780 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 ...
user avatar
  • 313
4 votes
2 answers
473 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 ...
user avatar
  • 14.2k
2 votes
3 answers
617 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> &...
user avatar
0 votes
1 answer
71 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]]&...
user avatar
  • 3
0 votes
0 answers
34 views

bash script to fill in .xml with different values

my xml will be something like this. in the sections labeled <File> I want to be able to pull from a directory and add cad files, maybe 15 to 20. Currently it needs to be done manually adding ...
user avatar
2 votes
3 answers
162 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 ...
user avatar
  • 47
2 votes
3 answers
250 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=...
user avatar
3 votes
2 answers
871 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 ...
user avatar
  • 31
0 votes
1 answer
25 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; & ...
user avatar
  • 128
0 votes
1 answer
32 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(., &...
user avatar
  • 139
1 vote
3 answers
212 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 ...
user avatar
  • 139
1 vote
1 answer
179 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"> <...
user avatar
0 votes
1 answer
54 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 ...
user avatar
  • 101
4 votes
6 answers
1k 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='...
user avatar
2 votes
4 answers
690 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" ...
user avatar
0 votes
0 answers
26 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 ...
user avatar
  • 1,513
0 votes
1 answer
238 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&...
user avatar
  • 11

1
2 3 4 5
8