Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
53 views

Parse txt file on basis of occurrence of a tag in Linux

I am trying to parse a txt file containing xml "messages"in linux, something like this <Document abc xyz .....> <hji> xyz </hji> </Document> <Document abc xyz ........
python6's user avatar
1 vote
3 answers
57 views

using grep (or something similar) to find when rows are missing

I'm trying to find when certain rows are missing in a file. See below. In each record, there is an ItemNumber, MessageNumber, NewItemNumber, and ConfirmedQty field. Is there a way to find ItemNumber ...
Dan's user avatar
  • 11
-1 votes
3 answers
109 views

sed inline not working to modify XML-style input

the problem is that I cannot put the complete command on a line with SED, I had already done it but with those file it does not work: my exemple : <file>Documents/time/text1</file> //2X ...
Allan Tori's user avatar
2 votes
4 answers
149 views

SED command to delete a forward slash "/" between 2 tags

I am using Linux, and I want to use sed to delete a forward slash (/) between 2 tags. From this: <file>/text</file> <file>/text2</file <file>/text</file>.. to this &...
Allan Tori's user avatar
0 votes
3 answers
85 views

sed command gets me error Label too long: on solaris

Given database name oltt206 or DB01 i wish to extract its respective username, password and connection string from the xml below: wladmin@myremhost:/tmp$ cat /web/bea_apps/uat/Tomcat_Home_v9.0.56/...
Ashar's user avatar
  • 501
4 votes
4 answers
972 views

Can I extract complete dates from file with grep command?

I need help using grep to extract a zoned date time from a file on a Linux system. Source file is a XML with the data below: <item start="20231010073000 +0100" stop="20231010100000 +...
aris's user avatar
  • 43
0 votes
2 answers
407 views

Shell command- to extract a string from xml file

There is a function Parse_xml as below Parse_XML() { TDIR=$1 _VERSION= _REVISION= _FILENAME= _COMPONENT= _DESCRIPT= _ISITOA=0 _NOLOG=0 _OAVERSION= local ...
raj's user avatar
  • 1
0 votes
3 answers
124 views

How to extract table of contents from fb2 book?

I have a book in fb2 format. I want to print the table of contents, containing names and numbers of "parts", "chapters", "episodes" and so on. Is there a way I can do ...
Ashark's user avatar
  • 959
0 votes
1 answer
356 views

libvirt rejects passthrough USB in XML

On a Debian 10 machine, I have a KVM VM with Windows 10. It runs fine. The libvirt version is 5.0.0-4+deb10u1. I want the VM to recognize a video camera that is attached to the Debian host via USB. ...
berndbausch's user avatar
  • 3,557
0 votes
1 answer
50 views

extract block from XML with different ending tags (<tag>...</tag> vs <tag ... />)

Given an XML with some blocks ending within the same tag and others with a separate tag: <parent name="parent_1" team="team_a"> <child name="child_1" team=&...
Will1v's user avatar
  • 13
3 votes
1 answer
326 views

'xmlstarlet edit' using a variable as XPath

When you follow the doc: xmlstarlet edit --help you can read that --var can be used to declare a XPath expression as a variable. Generating moc file: cat<<EOF > /tmp/file.xml <root> &...
Mévatlavé Kraspek's user avatar
4 votes
1 answer
237 views

Sum values in xmlstarlet from two siblings?

I am using xmlstarlet to extract text from elements with a specific preceding sibling event. An example from the XML file: <event type='cue' units='sec'> <onset>11.134</onset> ...
XMLnewbie's user avatar
1 vote
0 answers
2k views

Cannot Edit KVM Machine's XML; Failed to validate against schema

When trying to save XML changes in Vim this error occurs: error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng Extra element ...
Darmeris's user avatar
2 votes
2 answers
3k views

How can I sort XML elements by their attributes?

How can I sort this XML? first by alphabetical element: module before property. then by the alphabetical name attribute: <module name="ClassTypeParameterName"/> before <module name=...
caduceus's user avatar
  • 145
1 vote
2 answers
76 views

XMLERR: Element '=").*?(?=")</regex' not closed while using lookaround

I am trying to use lookaround element in PCRE2 regex for Wazuh tool, i need to match strings which are in double quotes and made the below regex however it looks its picking up "<" ...
Atul's user avatar
  • 1,891
0 votes
2 answers
56 views

script to swap strings containing newlines within text file (XML)

I am using Arch which was updated a couple of weeks ago. Packages is use are Arch 6.0.10-arch2-1 BASH 5.1.16(1)-release gnu sed 4.9 gnu grep 3.8 openbox 3.6.1 Within my Openbox rc.xml text file I ...
Kes's user avatar
  • 859
1 vote
2 answers
286 views

Extract IP:PORT from a curl output

I want to get list ip:port from the curl output of curl https://www.gametracker.com/search/?sort=5&order=ASC I cannot post the whole output as it is very big, just posting the part from where we ...
ph3ro's user avatar
  • 378
3 votes
3 answers
2k views

Create CSV from an xml file

I'm trying to create a csv from an xml with just some information from the xml. This is my xml : <?xml version="1.0" encoding="UTF-8"?> <hashlist version = "2.0" ...
MrBotus's user avatar
  • 31
0 votes
1 answer
135 views

Using sed to search multiple strings in XML file

I need to filter a big file XML and find the string using a multiple conditions. I need a filter a email if cnisfCF equal true and natg_passwordAlreadyResetedPostMigration is true. Anyone can help ? &...
user341's user avatar
-1 votes
3 answers
147 views

Extracting SMS data from a XML

I have a large xml file of my SMS messages. I want to put them into an easily accessible csv format. I've been trying to extract the 'address', 'messageBody' and 'messageTime' sections specifically ...
Luke's user avatar
  • 1
0 votes
1 answer
602 views

Getting specific entries of a log file using awk

I'm currently trying to use awk to grab items from massive log files matching specific criteria. Essentially, I need to be able to pull the entire command, marked by a transaction ID, based on ...
Brickscrap's user avatar
1 vote
2 answers
2k views

How may I replace a string in an XML file?

I am trying to replace the string inside an XML file. From <hello="value" exampleno="xxxx:yyyyyyyy/dd=eeeee-ffffff,aa=bb ccc,dd=eeee,ff=gggg,hh=iii,jj=kkk,ll=mmmm" /> I want ...
Ganesh's user avatar
  • 19
3 votes
3 answers
501 views

Identify strings between patterns and print entire region between pattern if string is found. Perferably using awk

There are similar questions but none of them quite address the issue I have. Simply put, I need to print every block that contains any string I'm looking for. Each block start line contains: <entry ...
Giles's user avatar
  • 887
-4 votes
3 answers
167 views

Unix command to grep above and below until a certain text appears

Consider the below example where '12345' is a unique id for the entire xml. <Tag 1> a b c d 12345 x y z </Tag 1> I need a command where I can grep '12345' in my file and go above and ...
Paridhi Saxena's user avatar
0 votes
3 answers
184 views

find text between > < for a given variable and change text to something else

If I search file eg. file.xml for s_webdomain I will get: <hostname oa_var="s_webhost">hostname</hostname> <externURL oa_var="s_external_url">https://...
AUser's user avatar
  • 3
2 votes
1 answer
640 views

Insert contents of file into XML attribute

I have a text file called branch.txt: $ cat branch.txt DEMAND_NAME-CR-1234 DEMAND_NAME-CR-8970 Using the above branch name, I have to find and replace some values using a sed command: branch_name=`(...
viswa's user avatar
  • 23
0 votes
2 answers
430 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…> <...
Aleks Under's user avatar
0 votes
2 answers
112 views

Renaming xml file based on tag

I have a number of xml files. I need to rename each based on the specific tag (say tag1="alpha") inside the xml. I have figured out how to rename the file based on single occurance of the ...
Simon Ante's user avatar
0 votes
3 answers
166 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 ...
k.Cyborg's user avatar
  • 497
0 votes
3 answers
40 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> ...
bash_noob's user avatar
0 votes
1 answer
86 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>...
Joey's user avatar
  • 199
5 votes
2 answers
1k 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 ...
Googlebot's user avatar
  • 1,959
2 votes
1 answer
116 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 ...
Matt5's user avatar
  • 87
4 votes
1 answer
742 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 ...
Matt5's user avatar
  • 87
2 votes
1 answer
4k 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 ...
Matt5's user avatar
  • 87
-1 votes
1 answer
179 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:...
guest's user avatar
  • 1
-1 votes
2 answers
867 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/...
Alfador's user avatar
-2 votes
2 answers
344 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 ...
Tee-ess's user avatar
  • 11
0 votes
1 answer
225 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 ...
jessefournier's user avatar
-1 votes
1 answer
46 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="...
raghav's user avatar
  • 11
1 vote
5 answers
1k 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....
Ashar's user avatar
  • 501
3 votes
4 answers
967 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
1k 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 ...
rajesh's user avatar
  • 3
-1 votes
2 answers
132 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 ...
Akshay Kumar's user avatar
4 votes
3 answers
1k 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</...
Diego's user avatar
  • 43
0 votes
0 answers
219 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 ...
DonBaka's user avatar
  • 101
0 votes
3 answers
648 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 ...
user508787's user avatar
0 votes
1 answer
249 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 ...
einpoklum's user avatar
  • 9,615
0 votes
2 answers
129 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; &...
user15992's user avatar
  • 697
1 vote
4 answers
357 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=...
Arets Paeglis's user avatar

1
2 3 4 5
9