Questions tagged [xml]

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

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

extract values between 2 strings

I wanted to extract the values between entitlement <?xml version="1.0" encoding="UTF-8" standalone="yes"?><HorizonResponse><assignedDevices><assignedDevice><deviceType>...
-2
votes
0answers
17 views

Shell script to find the string in the XML1 file between tags and raplace from another XML2 file

The XML1 file has several ... tags. I need a script to find the string "thing03" in the XML file between the beginning of the tag and closing the tag and replace it only with the string "thing03" ...
1
vote
1answer
64 views

how to extract a specific value from an XML file, the value after the XML tag; (ex.after = sign?)

I have a file which has ReferenceId="0128140321960O" and also RelatedReferenceId="SWCC" <FinancialTransfersInstruction xmlns="middleware.frk.com/Schemas/Onetis/1.0"> <SWIFTHeader ...
0
votes
1answer
24 views

Script to remove all modules in pom.xml except the one with the highest number

Question I have a huge pom.xml from a Talend DI/ESB project, where it was possible to have multiple lines for the same module with different Talend specific versions (don't even ask for that :-( ) ...
0
votes
0answers
15 views

Sending an xml file in a <Stream> from Ubuntu to Windows

We are sending an xml file through a <Stream>...</Stream> entity in a SOAP message from one machine to another. Receiver has a Windows OS. Previous sender was Windows as well, but now it ...
0
votes
0answers
16 views

Empty tag addition using UNIX

My input xml data <financial-details><financial-detail><bucket-name>abc</bucket-name><bucket-transaction-type>PLACEMENT</bucket-transaction-type><transaction-...
0
votes
4answers
68 views

how to remove New line character using Sed or perl [duplicate]

I have a huge file of XML data containing the lines like <fonts> some of the data </fonts> <fonts> some of the data </fonts> <fonts> some of the data </fonts> <...
1
vote
0answers
39 views

Tool to convert multi-document YAML to XML

Are there any command-line tools to convert YAML to XML? I've seen that there are several websites that offer YAML to XML conversions, however none of them seem to support YAML files containing ...
1
vote
3answers
74 views

Linux sed regex escape

I use sed -i to replace the port value in a xml file, <property name="port" value="8954" /> But I don't know how escape the regex, my regex is below. (?<=name="port"\s+value=")\d+(?=") ...
0
votes
1answer
62 views

how to parse the xml that have multiple properties and names

if we are having a XML script like this , How to get the value of a particular name using XML parsing <?XML> <conf> <prop><name>something</name><value>1</value&...
1
vote
1answer
51 views

How to find max value from specific XML element using a Perl one liner?

I have an XML file with the following syntax <element> <id>0</id> <tag1>something</tag1> ... <tagn>something</tagn> </element> <element> ...
-1
votes
1answer
53 views

To get the value of specific attribute value as True or False, having uneven columns [duplicate]

I am having one file with the below two lines in the file. I need to check if the value of xpoweredBy is true or false. Many thanks in advance. <Connector clientAuth="false" sslProtocol="TLS"...
0
votes
1answer
39 views

Add some text after the 4 lines of the matching pattern using shell

I have a xml input file which contains below INPUT FILE <Formula> <name>Total Invoices Released</name> <comment></comment> <sumType>Suspense</sumType> <...
0
votes
1answer
13 views

Using XSLT to create elements where there are no corresponding elements as hooks

I have a long HTML table that I am transforming to XML and breaking up into sections. Abbreviated source: <html> <head> <title>Sample doc</title> </head> <body> &...
1
vote
4answers
96 views

Duplicate two lines matching two different patterns in xml file using SED or AWK

I have the large xml file with the following type of lines: <test type="one" valid="yes" description="something"> twilight-.*\.iso\.auth</test> <test type="one" ...
1
vote
1answer
49 views

sed - include all found in between 2 pattern, except what's found between other pattern

I have a sed pattern search as below: sed -n '/<centerline/,/<\/centerline/p' This finds everything in between <centerline> and </centerline> I want to ignore all the cases where ...
0
votes
2answers
58 views

Delete line only if previous line has tag - sed ? or easier?

I'm facing a rather newbie problem and caught my ears around it :( I have a file with xml tags and I want that when I find: </ac:image> </a> the </ac:image> one followed by ...
1
vote
1answer
46 views

Find a specific record from an XML file [closed]

I have an XML with one record each in same xml tags; sample given as below. I need to get the specific record displayed by giving the search pattern as '4017|95592'. Output should be: 4017|95592|S|Y|...
8
votes
6answers
2k views

Extract an attribute value from XML

Using Bash, File: <?xml version="1.0" encoding="UTF-8"?> <blah> <blah1 path="er" name="andy" remote="origin" branch="master" tag="true" /> <blah1 path="er/er1" name="...
-1
votes
2answers
50 views

How to replace a matching string if n+2 line does not contain a particular string

<?xml version="1.0" encoding="UTF-8"?> <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/...
0
votes
1answer
216 views

How to add line in xml file

I want to add one line in xml file. My xml file contains as follows: <?xml version="1.0" encoding="UTF-8"?> <configuration> <ftp_destination_ip>0.0.0.0</...
0
votes
1answer
13 views

Pass along contents of XML node for additional processing in XSLT

I have a long, human-generated XML file with enough regularity for me to identify its contents using Xpath. I'm trying to reformat it as an HTML table. The source material is technically formatted as ...
3
votes
1answer
161 views

Creating new elements with xmlstarlet

I have been trying to to add new elements to an XML file. Original file: <levela> <levelb> </levelb> </levela> I'm trying to get the following result: <levela> &...
0
votes
2answers
34 views

bash - split by single character and match found items by string

tl;dr: Considering following input, which is some kind of a "list" of devices from nodes, I want to get the IP addresses, but only from devices named 'router.' (not router1., nor gw. or others): gw....
0
votes
1answer
20 views

XSLT attribute-transformation doubly whammy

I have an XML document that I am transforming into HTML. There are a lot of unnecessary attributes that I want to omit, but there are two that I want to capture as follows: Source <element att1="...
0
votes
0answers
25 views

script to prompt for password for encrypted disks

I have a headless Mac mini running Darwin 15.6.0, which has several encrypted disks attached. Since it's headless, after reboot, I need to ssh in to the box, and enter the passwords for the drives. ...
1
vote
2answers
133 views

How to remove duplicate lines inside specifc tag in a XML file

Suppose you have the following file: ... <tag2> a b c a </tag2> ... <tag2> x y y z x </tag2> How to remove the duplicate lines inside ...
0
votes
1answer
111 views

Complex string replace - multiple files, multiple different strings, must include certain text

I have a number of XML files (Atlassian Confluence space exports FYI), that I need to parse through to replace certain strings, as long as the line begins with a set string. Here is an example of a ...
2
votes
1answer
100 views

extracting security profile specific files RHEL CentOS

during the install of RHEL 7.x or CentOS one can choose (or not choose) to apply one of these security profiles these are from 7.6: United States Government Configuration Baseline Standard System ...
0
votes
0answers
76 views

How to extract only XML message from log file having text and XML message both

Below are the sample output: er : [com.rbsg.digital.platform.model.persistence.entity.EntityAddressDTO.individuals#263660] 2019-04-13 05:00:19.924 DEBUG LENDING_DIGITAL_CERT_STAFF_LBZ5_PROD_MM [http-...
0
votes
3answers
72 views

extract specific words and its data from html/xml file

sample input is <bre rt="1600" et="1550794901464" st="1550794899864" tid="8390500116294391399" mh="N" cn="" lc="" ts="N/A" cidc="" IDC="" eidc="BRE-S-TRA-0085418501"/> <r1> &...
1
vote
1answer
328 views

shell script-to get the value between tags in xml

My xml file is in the below format. I want to get the value between <fullName>..</fullName> tags say ABC and DEF. I am writing this in a while loop to reach each line as I need the value ...
0
votes
0answers
19 views

Remove section from XML files through scheduled script

-<decsub:invoices> <decsub:invoiceSeqNo>1</decsub:invoiceSeqNo> <deccm:invoiceCost>6431.000</deccm:invoiceCost> <deccm:invoiceCurrency>410</deccm:invoiceCurrency&...
-2
votes
3answers
466 views

Using AWK to parse from XML

I need just the first instance of an ANSI formatted date (YYYY-MM-DD) from the string shown below. PosMntReq ReqId="XXXXX" TxnTyp="4" Actn="1" BizDt="2019-03-27" TxnTm="2019-03-27T10:41:13" AdjTyp="...
0
votes
1answer
316 views

Extract select match value of same contents in XML file

I using this command for below xml file. xmlstarlet sel -t -v '//channel[protected = "True"]/playlist_url' -nl file.xml and result; host.net/aa/vodpr host.net/aa/vodpr/con_tv_r.php Can I choose a ...
1
vote
1answer
570 views

How to extract selected value in XML

I would like to extract only a value from similar content XML file. Example; <?xml version="1.0" encoding="UTF-8" ?> <items> <channel> <title><![CDATA[*** text 1 text *...
0
votes
1answer
59 views

Generating a ssh Host config file out of a Supperputty XML file

I am building a script that generates an ssh config file out of a Supperputty XML Session config file. I don't know which tool could handle it better. I try to achieve it with awk, but I don't receive ...
0
votes
1answer
106 views

How to extract the URL from xml or any text file

My XML file; <settings version="2"> <setting id="TimeShift" default="true">0</setting> <setting id="Override" default="true">false</setting> <setting id="...
0
votes
1answer
133 views

Find and Replace in Unix - XML File

I have output XML file which has string in each line icn="1", this number inside the double quotes will be changing for every line. But this number is not incrementing in order, so i have to make ...
1
vote
2answers
415 views

Change value inside xml attribute using sed?

I have the following attribute: <client-version>1.2.8</client-version> How can I replace everything inside <client-version></client-version> to only change the value (1.2.8)? ...
-3
votes
3answers
2k 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<...
-1
votes
1answer
70 views

Replacing a value in an XML document with another value taken from elsewhere in the document

Script: #!/bin/ksh tu=$(cat /export/home/a1016169/stack.txt;) tu1=$(echo "$tu" | awk '/EM_CLIENT_VERSION/{x=NR+17}(NR<=x){print}' | awk '/tu/{x=NR+1}(NR<=x){getline; print}' | awk -F= '{print $...
1
vote
2answers
60 views

SED replace string inside a string

I have the following script: originalLine='<com.whatsapp.voipcalling.VideoCallParticipantViewLayout android:id="@id/video_participant_views" android:layout_width="fill_parent" android:...
2
votes
5answers
175 views

SED remove spaces and line breaks

I have the following xml file: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:enabled="false" android:orientation="horizontal" android:id="@id/action_container" ...
0
votes
1answer
267 views

Set bash variables from XML tags

I have the following xml file <root> <deviceID>IO238470374109730497</devicdeID> <KeyValuePairs> <KeyValuePair> <BASE-URL>site.com</BASE-URL> &...
1
vote
1answer
218 views

How to delete tags from xml

I have the following XML file: <?xml version="1.0" encoding="utf-8"?> <deviceID>IO238470374109730497</devicdeID> <KeyValuePairs> <KeyValuePair> <BASE-URL>...
0
votes
0answers
20 views

Match a string and delete the line which is part of that tag in xml using sed, awk, in liu [duplicate]

Need to search a string "oneFi institution="12345678"" and need to delete only the "value maxPAN="19" minPAN="4" prefix="528749"/" Actual: <oneFi institution="12345678"> <...
0
votes
2answers
203 views

Find a string in xml tag and delete a line which is part of match tag

Need to search a string <oneFi institution="12345678"> and need to delete only the <value maxPAN="19" minPAN="4" prefix="528749"/> Actual: <oneFi institution="12345678"> ...
-4
votes
2answers
75 views

Finding specific string in XML file and storing in another file [closed]

Text in input file is like this <title> <band height="21" isSplitAllowed="true" > <staticText> <reportElement x="1" y="1" ...
-4
votes
2answers
177 views

Extract content between tags which is having sub tag

Extract the desired content from the file using "xmlstarlet" or "sed" or "awk" or some similar tool. The process should refer the full name of the particular businessprocesses and then should just ...