Could any one tell me how to read and match multiple lines in perl? Did this code below still work in this situation?
while (<FILE>) {
if (/ /) {
}
}
Thanks a lot! (5 Replies)
I made a script that can swap info on two lines using a combination of awk and sed, but was hoping to consolidate the script to make it run faster. If found this script, but can't seem to get it to work in a bash shell. I keep getting the error "Too many {'s". Any help here would be appreciated:... (38 Replies)
First of all, I know this can be more eassily done with perl or other scripting languages but, that's not the issue. I need this in sed. (or wander if it's possible )
I got a file (trace file to recreate the control file from oracle for the dba boys)
which contains
some lines
another line... (11 Replies)
Hi folks,
I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)
Greetings all,
I am trying to match a string, and after that insert a few lines above that match.
The string is "Version 1.0.0". I need to insert a few lines ONLY above the first match (there are many Version numbers in the file). The rest of the matches must be ignored. The lines I need to... (2 Replies)
Hello,
Could someone help me with sed. I have searched for solution 5 days allready :wall:, but cant find. Unfortunately my "sed" knowledge not good enough to manage it. I have the text:
123, foo1, bar1, short text1, dat1e, stable_pattern
124, foo2, bar2, long text
with few
lines, date,... (4 Replies)
I want to do something like sed -n '/PATTERN/,+10p' and get the ten lines following PATTERN. However, this throws an "expected context address" with the sed that comes with OSX Lion. If that + is a GNUism, can I do this, or do I have to find another tool? (2 Replies)
Discussion started by: jnojr
2 Replies
LEARN ABOUT DEBIAN
test::xml::twig
Test::XML::Twig(3pm) User Contributed Perl Documentation Test::XML::Twig(3pm)NAME
Test::XML::Twig - Test XML::Twig handlers
SYNOPSIS
use Test::XML::Twig tests => 2;
use My::Twig qw( handler );
test_twig_handler(
&handler,
'<foo/>', '<bar/>',
'turns foo to bar',
);
test_twig_handlers(
{ twig_handlers => { 'foo' => &handler } },
'<foo/>', '<bar/>',
'turns foo into bar',
);
DESCRIPTION
This module is for testing XML::Twig handlers.
FUNCTIONS
All functions are exported.
get_twig ( INPUT [, ARGS ] )
Return a parsed twig of INPUT, or undef on parse failure. Optionally, ARGS may be supplied as a set of hash-like parameters to be
passed into the twig constructor.
test_twig_handler ( HANDLER, INPUT, EXPECTED, TESTNAME [, COND ] )
Parse INPUT, using HANDLER as a twig_handler (i.e: it gets called after the parse tree has been built). Tests that the result is the
same as EXPECTED (which can be either a string of XML or a quoted regex). HANDLER must be a code ref.
Optionally, COND can be supplied. Instead of the handler being called with the root element of INPUT, COND will be used with
first_child() to select an alternative element.
Returns true / false depending upon test success.
test_twig_handlers ( ARGS, INPUT, EXPECTED, TESTNAME )
This is similiar to test_twig_handler(), but with more flexibility. The first argument, ARGS, is a hash reference which can be used to
specify any of the ordinary parameters to twig's constructor. This lets you test things like start_tag_handlers, as well as multiple
twig_handlers together.
SEE ALSO
Test::More, Test::XML, XML::Twig.
AUTHOR
Dominic Mitchell, <cpan2 (at) semantico.com>
COPYRIGHT AND LICENSE
Copyright 2002 by semantico
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2009-07-02 Test::XML::Twig(3pm)