Here is simplified case..
perl one liner can get quite big if we have to extract more fields from XML.
So how can we break text in single quotes perl -nle '</regex/ and all kinds of logic' resources.xml into multiple lines for readability?
is there a different way to pass parameters, other than export var; then perl -nle '<$ENV{var}>' approach?
input --> resources.xml
Command
Output
Last edited by kchinnam; 06-14-2016 at 10:46 AM..
Reason: formatting
I've got a configuration file that is filled with xml text statements for example:
<...../>
<...../>
<...../>
<data id="java-options" value="-server -Djava.security.policy..../>
<...../>
<...../>
<...../>
I want to write a korn shell script that will go to this specific line and add a... (2 Replies)
Hi All, I love this site, it helps newbie people like me and I appreciate everyone's help!
Here is my questions.
I am trying to concatenate a single quote into a character/string from a text file for each line (lets say ABC should look like 'ABC').
I tried to use awk print command to do... (1 Reply)
I need a script to process a huge single line text file:
The sample of the text is:
"forward_inline_item": "Inline", "options_region_Australia": "Australia", "server_event_err_msg": "There was an error attempting to save", "Token": "Yes", "family": "Family","pwd_login_tab": "Enter Your... (1 Reply)
Hi I want to replace single quote with two single quotes in a perl string.
If the string is <It's Simpson's book> It should become <It''s Simpson''s book> (3 Replies)
Hi There...
I need to serach and replace a strings in a text file.
My file has; books.amazon='Let me read' and the output needed is
books.amazon=NONFOUND
pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
Hi,
I need to correct line breaks for huge files (more than 1MM records in a file) and then format it properly.
Except the header and trailer, each record starts with 'D'.
Requirement:Scan the whole file except the header and trailer records and see if any of the records start with... (19 Replies)
Hi Guys,
I have the following file.
DbName=DBNAME
DbUser=USERID
DbPass=PASSLL
SrcLocation=/appl/data/VSTAR
SrcFile1=gmb_dly_ind_sls_20120410133424.txt
SrcFile2=
IpLocation=/appl/data/VSTAR/global_daily/input/GMB
IpFile=gmb_dly_ind_sls_20120410133424.txt... (4 Replies)
Hi
I have input vi file as below
a000000
b000000
c000000
d000000
Need output as below
'a000000','b000000','c000000','d000000'
Please let us know how to do it (3 Replies)
Shell : bash that comes with RHEL 6.7
I have SQL scripts like below. I want to convert all the text in these files to lower case except the strings enclosed within single quotes .
Any idea how I can achieve this ?
Sample text:
$ cat sample.txt
SELECT ... (6 Replies)
Regarding copy/pasted text of copyright-free book from archive.org (link below), in attempt to expand single-line-break paragraph text (not section headings or paragraph breaks) to wider right margin, Justify or Wrap in LIbreOffice is not working, and Find/Replace the paragraph mark ($) wraps all... (2 Replies)
Discussion started by: p1ne
2 Replies
LEARN ABOUT DEBIAN
mkdoc::xml::dumper
MKDoc::XML::Dumper(3pm) User Contributed Perl Documentation MKDoc::XML::Dumper(3pm)NAME
MKDoc::XML::Dumper - Same as Data::Dumper, but with XML
SYNOPSIS
use MKDoc::XML::Dumper;
use Test::More 'no_plan';
my $stuff = [ qw /foo bar baz/, [], { hello => 'world', yo => \'boo' } ];
my $xml = MKDoc::XML::Dumper->perl2xml ($stuff);
my $stuff2 = MKDoc::XML::Dumper->xml2perl ($xml);
is_deeply ($stuff, $stuff2); # prints 'ok'
SUMMARY
MKDoc::XML::Dumper provides functionality equivalent to Data::Dumper except that rather than serializing structures into a Perl string, it
serializes them into a generic XML file format.
Of course since XML cannot be evaled, it also provides a mechanism for undumping the xml back into a perl structure.
MKDoc::XML::Dumper supports scalar references, hash references, array references, reference references, and litterals. It also supports
circular structures and back references to avoid creating unwanted extra copies of the same object.
That's all there is to it!
API
my $xml = MKDoc::XML::Dumper->perl2xml ($perl);
Turns $perl into an XML string. For instance:
my $perl = [ qw /foo bar baz/, { adam => 'apple', bruno => 'berry', chris => 'cherry' } ];
print MKDoc::XML::Dumper->perl2xml ($perl);'
Will print something like:
<array id="135338912">
<item key="0">
<litteral>foo</litteral>
</item>
<item key="1">
<litteral>bar</litteral>
</item>
<item key="2">
<litteral>baz</litteral>
</item>
<item key="3">
<hash id="135338708">
<item key="bruno">
<litteral>berry</litteral>
</item>
<item key="adam">
<litteral>apple</litteral>
</item>
<item key="chris">
<litteral>cherry</litteral>
</item>
</hash>
</item>
</array>
As you can see, every object has an id. This allows for backreferencing, so:
my $perl = undef;
$perl = $perl;
print MKDoc::XML::Dumper->perl2xml ($perl);'
Prints something like:
<ref id="135338888">
<backref id="135338888" />
</ref>
For the curious, these identifiers are computed using some perl black magic:
my $id = 0 + $reference;
my $perl = MKDoc::XML::Dumper->perl2xml ($xml);
Does the exact reverse operation as xml2perl().
AUTHOR
Copyright 2003 - MKDoc Holdings Ltd.
Author: Jean-Michel Hiver
This module is free software and is distributed under the same license as Perl itself. Use it at your own risk.
SEE ALSO
MKDoc::XML::Decode MKDoc::XML::Encode
perl v5.10.1 2004-10-06 MKDoc::XML::Dumper(3pm)