Hi,
If i have a file with xml format, i would like to remove duplicated records and save to a new file. Is it possible...to write script to do it? (8 Replies)
Hi,
I am new to UNIX scripting and woiuld appreicate your help...
Input file contains only one (but long) record:
aaaaabbbbbcccccddddd.....
Desired file:
NEW RECORD #new record (hardcoded) added as first record - its length is irrelevant#
aaaaa
bbbbb
ccccc
ddddd
...
...
... (1 Reply)
Hi guys,
i have a big file with the following format.This includes header(H),detail(D) and trailer(T) information in the file.My problem is i have to search for the character "6h" at 14 th and 15 th position in all the records .if it is there i have to write all those records into a... (1 Reply)
Hi
I have an xml file which has multiple xml records..
I don't know how to read those records and pipe them to another shell command
the file is like
<abc>z<def>y<ghi>x........</ghi></def></abc> (1st record)
<jkl>z<mno>y<pqr>x........</pqr></mno></jkl> (2nd record)
Each record end... (4 Replies)
Hi all
I want to inquire that is there any unix command that can help me while extracting first and last line in a file ( TEST.dat)
for example in the below record i want to extract the line that are in BOLD text or in other words i want to extract line no 1,3,4 and 7
aa 1 2 3
aa 2 3 4... (5 Replies)
Hi All,
I have a requirement to perform the following checks.
Input file is a "|" delimited file and looks like this.
A|c1|c2|c3|....
B|G1|G2|G3....
C|H1|H2|H3...
A|c4|c5|c6|....
B|G4|G5|G6....
C|H4|H5|H6...
Now the check is to see if all the "A" records have a corresponding B... (7 Replies)
find pattern, delete line with pattern and 3 lines above and 8 lines below the pattern. The pattern is "isup". The entire record with starting tag <record> and ending tag </record> containing the pattern is to be deleted and the rest to be retained.
<record>
... (4 Replies)
I have data coming in the below format for each record
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><testdetials>....</test_sox>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><test_sox... (8 Replies)
Discussion started by: dsravanam
8 Replies
LEARN ABOUT DEBIAN
test::xml::simple
Test::XML::Simple(3pm) User Contributed Perl Documentation Test::XML::Simple(3pm)NAME
Test::XML::Simple - easy testing for XML
SYNOPSIS
use Test::XML::Simple tests=>5;
xml_valid $xml, "Is valid XML";
xml_node $xml, "/xpath/expression", "specified xpath node is present";
xml_is, $xml, '/xpath/expr', "expected value", "specified text present";
xml_like, $xml, '/xpath/expr', qr/expected/, "regex text present";
xml_is_deeply, $xml, '/xpath/expr', $xml2, "structure and contents match";
# Not yet implemented:
# xml_like_deeply would be nice too...
DESCRIPTION
"Test::XML::Simple" is a very basic class for testing XML. It uses the XPath syntax to locate nodes within the XML. You can also check all
or part of the structure vs. an XML fragment.
TEST ROUTINES
xml_valid $xml, 'test description'
Pass an XML file or fragment to this test; it succeeds if the XML (fragment) is valid.
xml_node $xml, $xpath, 'test description'
Checks the supplied XML to see if the node described by the supplied XPath expression is present. Test fails if it is not present.
xml_is_long $xml, $xpath, $value, 'test description'
Finds the node corresponding to the supplied XPath expression and compares it to the supplied value. Succeeds if the two values match.
Uses Test::More's "is" function to do the comparison.
xml_is $xml, $xpath, $value, 'test description'
Finds the node corresponding to the supplied XPath expression and compares it to the supplied value. Succeeds if the two values match.
Uses Test::LongString's "is_string" function to do the test.
xml_like_long $xml, $xpath, $regex, 'test description'
Find the XML corresponding to the the XPath expression and check it against the supplied regular expression. Succeeds if they match. Uses
Test::More's "like" function to do the comparison.
xml_like $xml, $xpath, $regex, 'test description'
Find the XML corresponding to the the XPath expression and check it against the supplied regular expression. Succeeds if they match. Uses
Test::LongString's "like_string" function to do the test.
xml_is_deeply_long $xml, $xpath, $xml2, 'test description'
Find the piece of XML corresponding to the XPath expression, and compare its structure and contents to the second XML (fragment) supplied.
Succeeds if they match in structure and content. Uses Test::More's "is" function to do the comparison.
xml_is_deeply $xml, $xpath, $xml2, 'test description'
Find the piece of XML corresponding to the XPath expression, and compare its structure and contents to the second XML (fragment) supplied.
Succeeds if they match in structure and content. Uses Test::LongString's "is_string" function to do the test.
AUTHOR
Joe McMahon, <mcmahon@cpan.org>
LICENSE
Copyright (c) 2005 by Yahoo! and Joe McMahon
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or,
at your option, any later version of Perl 5 you may have available.
SEE ALSO
XML::XPath, Test::More, Test::Builder.
perl v5.14.2 2012-06-05 Test::XML::Simple(3pm)