You can try this, it is probably a lot more complicated that in needs to be but it seems to work. It trims the leading spaces before \Start as well so if that is undesired then it can be changed.
Dear friends
I am new to linux and was trying to split some files userwise in our linux server.
I have a data file of 156 continuous columns named ecscr final.
I want the script to redirect all the lines containing a pattern of 7 digits to separate files. I was using grep to do that,... (2 Replies)
I'm attempting to insert multiple lines before a line matching a given search pattern. These lines are generated in a separate function and can either be piped in as stdout or read from a temporary file.
I've been able to insert the lines from a file after the pattern using:
sed -i '/pattern/... (2 Replies)
Hi,
I would like to delete lines in /etc/hosts on few workstations, basically I want to delete all the lines for a list of machines like this :
for HOST in $(cat stations.lst |uniq)
do
# echo -n "$HOST"
if ping -c 1 $HOST > /dev/null 2>&1
then
HOSTNAME_val=`rsh $HOST "sed... (3 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)
Hi,
I need a help to search a pattern and print the multiple lines between them.
Input file:
Tue May 29 12:30:33 EDT 2012:threadWebContainer : 357:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelCancelReservation request: ... (4 Replies)
Hi,
I need to get specific parts in a large file.
I need to:
Get a line containing an IP address, and read from there to another line saying ***SNMP-END***
So, I have the start and the end well defined, but the problem is that apparently the awk command using the -F option doesn't work... (17 Replies)
Is there a way with aw to print all lines after a string is found
There is a file like this
.......
........
2012/19/11 :11.58 PM some data
lne no date
2012/19/11 :11.59 PM some other data
2012/20/11 :12.00 AM some other data
some line without dates
some more lines without dates... (8 Replies)
Hi
I know sed and awk has options to give range of line numbers, but
I need to replace pattern in specific lines
Something like
sed -e '1s,14s,26s/pattern/new pattern/' file name
Can somebody help me in this....
I am fine with see/awk/perl
Thank you in advance (9 Replies)
Dear gurus,
Please help this beginner to write and understand the required script. I am looking for useing awk for sed.
I have a few thousand lines file whose contain are mostly as below and I am trying to achieve followings.
1. Find a string, say user1. Then hash the line containing the... (6 Replies)
Hi,
I have text file that looks like this:
blabla
bla
PATTERN
LINE1
LINE2
bla
bla
bla
PATTERN
LINE1
LINE2
bla
PATTERN
LINE1
LINE2
bla (9 Replies)
Discussion started by: hench
9 Replies
LEARN ABOUT DEBIAN
xml::parser::lite
XML::Parser::Lite(3pm) User Contributed Perl Documentation XML::Parser::Lite(3pm)NAME
XML::Parser::Lite - Lightweight regexp-based XML parser
SYNOPSIS
use XML::Parser::Lite;
$p1 = new XML::Parser::Lite;
$p1->setHandlers(
Start => sub { shift; print "start: @_
" },
Char => sub { shift; print "char: @_
" },
End => sub { shift; print "end: @_
" },
);
$p1->parse('<foo id="me">Hello World!</foo>');
$p2 = new XML::Parser::Lite
Handlers => {
Start => sub { shift; print "start: @_
" },
Char => sub { shift; print "char: @_
" },
End => sub { shift; print "end: @_
" },
}
;
$p2->parse('<foo id="me">Hello <bar>cruel</bar> World!</foo>');
DESCRIPTION
This Perl implements an XML parser with a interface similar to XML::Parser. Though not all callbacks are supported, you should be able to
use it in the same way you use XML::Parser. Due to using experimantal regexp features it'll work only on Perl 5.6 and above and may behave
differently on different platforms.
Note that you cannot use regular expressions or split in callbacks. This is due to a limitation of perl's regular expression implementation
(which is not re-entrant).
SUBROUTINES /METHODS
new
Constructor.
As (almost) all SOAP::Lite constructors, new() returns the object called on when called as object method. This means that the following
effectifely is a no-op if $obj is a object:
$obj = $obj->new();
New accepts a single named parameter, "Handlers" with a hash ref as value:
my $parser = XML::Parser::Lite->new(
Handlers => {
Start => sub { shift; print "start: @_
" },
Char => sub { shift; print "char: @_
" },
End => sub { shift; print "end: @_
" },
}
);
The handlers given will be passed to setHandlers.
setHandlers
Sets (or resets) the parsing handlers. Accepts a hash with the handler names and handler code references as parameters. Passing "undef"
instead of a code reference replaces the handler by a no-op.
The following handlers can be set:
Init
Start
Char
End
Final
All other handlers are ignored.
Calling setHandlers without parameters resets all handlers to no-ops.
parse
Parses the XML given. In contrast to XML::Parser's parse method, parse() only parses strings.
Handler methods
Init
Called before parsing starts. You should perform any necessary initializations in Init.
Start
Called at the start of each XML node. See XML::Parser for details.
Char
Called for each character sequence. May be called multiple times for the characters contained in an XML node (even for every single
character). Your implementation has to make sure that it captures all characters.
End
Called at the end of each XML node. See XML::Parser for details
Comment
See XML::Parser for details
XMLDecl
See XML::Parser for details
Doctype
See XML::Parser for details
Final
Called at the end of the parsing process. You should perform any necessary cleanup here.
SEE ALSO
XML::Parser
COPYRIGHT
Copyright (C) 2000-2007 Paul Kulchenko. All rights reserved.
Copyright (C) 2008- Martin Kutter. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This parser is based on "shallow parser" http://www.cs.sfu.ca/~cameron/REX.html Copyright (c) 1998, Robert D. Cameron.
AUTHOR
Paul Kulchenko (paulclinger@yahoo.com)
Martin Kutter (martin.kutter@fen-net.de)
Additional handlers supplied by Adam Leggett.
perl v5.12.4 2011-08-29 XML::Parser::Lite(3pm)