Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [xml]

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

0
votes
2answers
26 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
17 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
24 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
31 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
66 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
31 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
29 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
45 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
48 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
53 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
26 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
56 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
31 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
45 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
67 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 ...
0
votes
2answers
141 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
310 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
63 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
57 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
90 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
51 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
103 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
19 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
77 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
51 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
70 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 ...
-2
votes
1answer
48 views

Extract string followed by specific word/symbol

I have two lines as shown below in my input file input.txt and I need to extract claimStartDate from first line and claimEndDate from second line. <ProfessionalClaim paymentIndicator="P" ...
-2
votes
1answer
49 views

adding comment tag on XML file through unix

INPUT XML FILE: <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <Dcn xmlns="http://schemas.test.com/2013/ClaimRequest" xsi:schemaLocation="http://schemas.test.com/2013/...
0
votes
1answer
104 views

xml_grep exclude element that contains an element

I'm trying to remove all elements from an XML file that contain a certain other element. Here's a very simplified version of what I'm trying to do. Suppose I have the XML file <RootEl> <...
-1
votes
3answers
83 views

how to find & replace a file path listed in a file

I have a file content as shown below. If a line has ".idt" word, then I need to check if there is a file path preceding it (eg: /bin/dir/test/abcdef.idt). If yes, then remove the file path and keep ...
2
votes
0answers
106 views

how to output html to a file with xmllint?

How do I get xmllint to output to a file? thufir@dur:~/xmllint$ thufir@dur:~/xmllint$ xmllint --html http://www.skynet.be/nieuws-sport/weer/mijn-weer?cityId=6450 --xpath '//div[@class = "tides"]' - ...
0
votes
2answers
876 views

Search and replace specific tag value in XML file with sed command

I have a task where by I have to manipulate an XML file through a bash shell script. Here are the steps: Query XML file for a value. Replace the value of a different element with the new value. ...
-2
votes
3answers
56 views

sed/awk string replacement with newline and tabs

I have an XML file that contains the following: <ipaddr>192.168.1.1</ipaddr> <subnet>24</subnet> The goal is to modify <ipaddr>192.168.1.1</ipaddr> to <...
0
votes
1answer
17 views

replacement of a string in xml

I am trying to replace folder name value in an xml file.I am searching with required pattern using grep and replace the folder name value which is DF_GCSS with ABC_DEF which comes from a variable....
2
votes
2answers
112 views

sed: extract lines until unmatched pattern

I am trying to extract lines from a file where the end string is different from the begin string I have the following input file in format: <item_id>6</item_id> <info1>abc</...
1
vote
1answer
58 views

Script for converting .org to .xml

I want to convert tree written in .org file to some XML code to generate graphic tree from it later (for example loading it to www.draw.io webpage). In order to do this I need a bash script which ...
-3
votes
2answers
471 views

Extract value from XML file using shell script [duplicate]

I have file filestore.xml from which I need to extract /local/armdata/data/filestore1, /local/armdata/data/filestore2. grep binariesDir filestore.xml <binariesDir>/local/armdata/data/...
1
vote
3answers
94 views

Bash output two results next to each other

I have an out from xmllint and egrep that I would like to print two fields next to each other. e.g. (xmlinput) xmllint --format | egrep reference\|sourcefile <reference>ItemX</reference> &...
0
votes
2answers
259 views

Using bash to replace html character entities in the xml file

I have a string like this in xml file: &lt;h3&gt;Styled here with: &lt;a href="$url('Product-Show','pid','107723102')$"&gt;FRS blo&lt;/a&gt;, &lt;a href="$url('Product-...
0
votes
3answers
77 views

How to remove content before a pattern in xml using unix

Source file example: <HDR></HDR><b></b><c></c> (XML file created in a single line) OR Source file example: <HDR> </HDR> <b> </b> <c&...
0
votes
1answer
43 views

using curl with ${=(System.nanoTime())} inside req.xml file

i want to be able generating system nano second sequence when using curl my code is like this: curl -X POST -H 'Content-type: text/xml' -d @req.xml server_URL > result.xml the req.xml contains ...
0
votes
1answer
607 views

xml parsing with pure bash

I need to parse an XML without an xmlparser, is this possible? I started with xmlstarlet, which works nice, but I can not use any real parser on that machine. I need it to be a one-liner. I just need ...
0
votes
2answers
106 views

remove anything between angle bracket including it [duplicate]

I have a very big text file ~ 105 G it's includes a lot of <XXXX> (angle brackets including text in between). I want to remove those brackets and text in between.
1
vote
1answer
30 views

Printing the contents between two strings that include escape characters (Linux/Bash)

I am trying to write a script that searches my server in many .app files and outputs the contents between two strings-- only outputting what occurs between the two strings. I am able to do this with ...
-2
votes
3answers
83 views

Need to parse XML file tag 'Asset Id' & associated child tags using a shell script?

I have the following XML that I'd like to parse/select the 'Asset Id' from using some method from the shell. <?xml version="1.0" encoding="UTF-8"?> <ns0:EcomAssetMetadataTransaction xmlns:...
-2
votes
2answers
100 views

How to use sed to extract from xml after doing a pattern match in one of the tags inside?

<Response <MessageID>ID:c3e2</MessageID> <Year>2018</Year> <ClntID>ABC</ClntID> <ParticipantID>12346789&...
0
votes
1answer
735 views

$1 not working with sed

I have a bunch of files that contain XML tags like: <h> PIDAT <h> O I need to delete everything what comes after the first <h> in that line, so I can get this: <h> For ...
3
votes
2answers
262 views

Insert new line after all occurrences of a pattern

I have a pmml file containing one line: <DataField dataType="string" name="class" optype="categorical"><Value value="y0" /><Value value="y1" /><Value value="y2" /><Value ...
-1
votes
2answers
136 views

Extract words from multiple strings using AWK/SED

I am looking for logic where in I am trying to extract words from multiple lines using AWK command in Linux Tried in multiple ways with AWK and SED but no results. Attached is the text file and ...