File Used: Here is the first line
The second line is fun
End
Need to print first and last character of each line and count of characters. Can display the first character, and maybe the last, not sure what the second line displays, it gives me and 'e', but thats not the last character? The count is wrong too, it gives one for everything. help please?!
Hello ,
I'm trying to split a file which contains a single very long line.
My aim is to split this single line each 120 characters.
I tried with the sed command :
`cat ${MYPATH}/${FILE}|sed -e :a -e 's/^.\{1,120\}$/&\n/;ta' >{MYPATH}/${DEST}`
but when I wc -l the destination file it is... (2 Replies)
I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this.
For example:
split -l 3000000 filename.txt
This is very slow and it splits the file with 3 million records in each... (10 Replies)
Hi friends
I need to splict special character "|" here.
Here is my script which giving error
LINE=INVTRAN|cd /home/msgGoogle
TraxFolderType=`awk -F"|" '{print $1}' $LINE`
filePath=`awk -F"|" '{print $2}' $LINE`
echo "TraxFolderType: "$TraxFolderType
echo "filePath :"$filePath
... (3 Replies)
Hello,
if i have file like this:
010000890306932455804 05306977653873 0520080417010520ISMS SMT ZZZZZZZZZZZZZOC30693599000 30971360000 ZZZZZZZZZZZZZZZZZZZZ202011302942311 010000890306946317387 05306977313623 0520080417010520ISMS SMT... (6 Replies)
Hi,
I have a requirement like this.
String=abcdefghijkl
I need to split this string into a substrign each 3 characters and write output into a file.
Output:
abc
def
ghi
jkl
Can any one please help me how can i acheive this
Thanks (3 Replies)
Hello;
I have a file consists of 4 columns separated by tab. The problem is the third fields. Some of the them are very long but can be split by the vertical bar "|". Also some of them do not contain the string "UniProt", but I could ignore it at this moment, and sort the file afterwards. Here is... (5 Replies)
Hi Experts.
I'm stuck with the below AWK code where i'm trying to move the records containing any special characters in the last field to a bad file.
awk -F, '{if ($NF ~ /^|^/) print >"goodfile";else print >"badfile"}' filename
sample data
1,abc,def,1234,A *
2,bed,dec,342,* A ... (6 Replies)
Hello I am new to scripts, codes, bash, terminal, etc.
I apologize this my be very scattered because I frankly don't have any idea where to begin and I have had trouble sleeping lately.
I have several 2GB files I wish to split.
This Code 00 00 01 BA ** ** ** ** ** ** ** ** C3 F8 00 00 01 BB 00... (17 Replies)
I have a requirement to split a huge file to smaller text files based on first four characters which look like
ABCD
1234
DFGH
RREX
:
:
:
:
:
0000
Each of these records are OF EQUAL bytes with a different internal layout based on the above first digit identifier..
Any help to start... (5 Replies)
Hi,
I've data like these:
Gene1,Gene2 snp1
Gene3 snp2
Gene4 snp3
I'd like to split line if comma and then print remaining information for the respective gene.
My code:
awk '{
if($1 ~ /,/){
n = split($0, t, ",") (7 Replies)
Discussion started by: genome
7 Replies
LEARN ABOUT SUSE
xml::parser::lite
XML::Parser::Lite(3) User Contributed Perl Documentation XML::Parser::Lite(3)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 neccessary 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.1 2010-03-18 XML::Parser::Lite(3)