Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract XML block when value is matched (Shell script) Post 303036175 by Pouky on Tuesday 18th of June 2019 06:10:01 AM
Old 06-18-2019
Hi anbu,


So the codeblock that I posted is the result that i want to achieve. We have multiple blocks like that (we're close to 1m lines) and i just want to extract 1 block out of it.
I don't know if it would help to deliver your a bigger sample of code.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract data from xml- shell script using awk

Hi, This is the xml file that i have. - <front-servlet platform="WAS4.0" request-retriever="SiteMinder-aware" configuration-rescan-interval="60000"> <concurrency-throttle maximum-concurrency="50" redirect-page="/jsp/defaulterror.jsp" /> - <loggers> <instrumentation... (5 Replies)
Discussion started by: nishana
5 Replies

2. Shell Programming and Scripting

Help with shell script to extract data from XML file

Hello Scripting Gurus, I need help with extracting data from the XML file using shell script. The data is in a large XML and I need to extract the id values of all completedworkflows. Here is a sample of it. Input and output data is also in the attached text files. <wfregistry>... (5 Replies)
Discussion started by: yajaykumar
5 Replies

3. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

4. Shell Programming and Scripting

Extract selective block from XML file

Hi, There's an xml file produced from a front-end tool as shown below: <INPUT DATABASE ="ORACLE" DBNAME ="UNIX" NAME ="FACT_TABLE" OWNERNAME ="DIPS"> <INPUTFIELD DATATYPE ="double" DEFAULTVALUE ="" DESCRIPTION ="" NAME ="STORE_KEY" PICTURETEXT ="" PORTTYPE ="INPUT" PRECISION ="15" SCALE... (6 Replies)
Discussion started by: dips_ag
6 Replies

5. Shell Programming and Scripting

Shell script to extract data in repeating tags from xml

Hi, I am new to shell scripting. I need to extract data between repeating tags from an xml file and store the data in an array to process it further. <ns1:root xmlns:ns1="http://example.com/config"> <ns1:interface>in1</ns1:interface> <ns1:operation attribute1="true" attribute2="abd"... (2 Replies)
Discussion started by: sailendra
2 Replies

6. Shell Programming and Scripting

How to extract data from xml file using shell scripting?

Hi evry1, This is my 1st post in this forum.Pls help me I want to extract some data froma xml file which has 2000 lines using shell scripting. Actually my xml file has some "audio and video codes" which i need to arrange in a column wise format after extracting it using shell scripting.I... (4 Replies)
Discussion started by: arun_kohan
4 Replies

7. Shell Programming and Scripting

How to extract data from XML file using shell scripting?

Hi , I have input file as XML. following are input data #complex.xml Code: <?xml version="1.0" encoding="UTF-8"?><TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: arun_kohan
1 Replies

8. Shell Programming and Scripting

Parse xml in shell script and extract records with specific condition

Hi I have xml file with multiple records and would like to extract records from xml with specific condition if specific tag is present extract entire row otherwise skip . <logentry revision="21510"> <author>mantest</author> <date>2015-02-27</date> <QC_ID>334566</QC_ID>... (12 Replies)
Discussion started by: madankumar.t@hp
12 Replies

9. Shell Programming and Scripting

Extract Matched Records from XML

Hi All, I have a requirement to extract para in XML file on the basis of another list file having specific parameters. I will extract these para from XML and import in one scheduler tool. file2 <FOLDER DATACENTER="ControlMserver" VERSION="800" PLATFORM="UNIX" FOLDER_NAME="SH_AP_INT_B01"... (3 Replies)
Discussion started by: looney
3 Replies

10. Shell Programming and Scripting

How can I extract XML block around matching search string?

I want to extract XML block surrounding search string Ex: print XML block for string "myapp1-ear" surrounded by "<application> .. </application>" Input XML: <?xml version="1.0" encoding="UTF-8"?> <deployment-request> <requestor> <first-name>kchinnam</first-name> ... (16 Replies)
Discussion started by: kchinnam
16 Replies
Text::WikiFormat::Blocks(3pm)				User Contributed Perl Documentation			     Text::WikiFormat::Blocks(3pm)

NAME
Text::WikiFormat::Blocks - blocktypes for Text::WikiFormat SYNOPSIS
None. Use Text::WikiFormat as the public interface, unless you want to create your own block type. DESCRIPTION
This module merely creates subclasses of Text::WikiFormat::Block, which is the interesting code. A block is a collection of related lines, such as a code block (text to display verbatim in a monospaced font), a header, an unordered list, an ordered list, and a paragraph (text to display in a proportional font). Every block extends "Text::WikiFormat::Block". METHODS
The following methods exist: o "new( %args )" Creates and returns a new block. The valid arguments are: o "text" The text of the line found in the block. o "args" The arguments captured by the block-identifying regular expression. o "level" The level of indentation for the block (usually only useful for list blocks). o "tags" The tags in effect for the current type of wiki formatting. o "opts" The options in effect for the current type of wiki formatting. Use the accessors of the same names to retrieve the values of the attributes. o "add_text( @lines_of_text )" Adds a list of lines of text to the current text for the block. This is very useful when you encounter a block and want to merge it with the previous block of the same type o "add_args( @arguments )" Adds further arguments to the block; useful when merging blocks. o "formatted_text()" Returns text formatted appropriately for this block. Blocks don't have to have formatters, but they may. o "formatter( $line_of_text )" Formats the $line using "Text::WikiFormat::format_line()". You can add your own formatter here; this is worth overriding. o "merge( $next_block )" Merges the current block with $next_block (the next block encountered) if they're of the same type and are at the same level. This adds the text and args of $next_block to the current block. It's your responsibility to remove $next_block from whatever your code iterates over. o "nests()" Returns true if this block should nest (as in lists and unordered lists) for the active wiki formatting. o "nest( $next_block )" Nests $next_block under this block if the both nest and if $next_block has a level greater than the current block. This actually adds $next_block as a text item within the current block. Beware. AUTHOR
chromatic, "chromatic at wgz dot org" BUGS
No known bugs. COPYRIGHT
Copyright (c) 2006, chromatic. Some rights reserved. This module is free software; you can use, redistribute, and modify it under the same terms as Perl 5.8.x. perl v5.10.1 2011-02-12 Text::WikiFormat::Blocks(3pm)
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy