Sponsored Content
Full Discussion: total last digits
Top Forums Shell Programming and Scripting total last digits Post 302307819 by radoulov on Thursday 16th of April 2009 11:28:10 AM
Old 04-16-2009
Or:

Code:
% perl -le'print length((split/[^5]/,shift)[-1])' 95952325555  
4
% perl -le'print length((split/[^5]/,shift)[-1])' 959523255555
5
% perl -le'print length((split/[^5]/,shift)[-1])' 9595232555  
3

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to cut last 10 digits off

Hi I'm new to this. I need to cut off the last 10 digits from a line. I've used awk {'print $4'} filename.txt | cut -c 32-42 but this does not guarantee only the last 10 characters. Please help. Thanks. Sara (4 Replies)
Discussion started by: psarava
4 Replies

2. UNIX for Dummies Questions & Answers

grep running total/ final total across multiple files

Ok, another fun hiccup in my UNIX learning curve. I am trying to count the number of occurrences of an IP address across multiple files named example.hits. I can extract the number of occurrences from the files individually but when you use grep -c with multiple files you get the output similar to... (5 Replies)
Discussion started by: MrAd
5 Replies

3. Shell Programming and Scripting

Formatting digits

I want to check the argument in KSH. If the user type in the prompt 'find 3' it will format 3 to 003 to match the data in the text file. Same as with 10 to 010. Always begins with 0. eg. >find 3 Output: 003 >find 30 Output: 030 (7 Replies)
Discussion started by: harry0013
7 Replies

4. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

5. Shell Programming and Scripting

help: single digits inflated to 2 digits

Hi Folks Probably an easy one here but how do I get a sequence to get used as mentioned. For example in the following I want to automatically create files that have a 2 digit number at the end of their names: m@pyhead:~$ for x in $(seq 00 10); do touch file_$x; done m@pyhead:~$ ls file*... (2 Replies)
Discussion started by: amadain
2 Replies

6. Shell Programming and Scripting

Help with sum total number of record and total number of record problem asking

Input file SFSQW 5192.56 HNRNPK 611.486 QEQW 1202.15 ASDR 568.627 QWET 6382.11 SFSQW 4386.3 HNRNPK 100 SFSQW 500 Desired output file SFSQW 10078.86 3 QWET 6382.11 1 QEQW 1202.15 1 HNRNPK 711.49 2 ASDR 568.63 1 The way I tried: (2 Replies)
Discussion started by: patrick87
2 Replies

7. Shell Programming and Scripting

Find filenames with three digits and add zeros to make five digits

Hello all! I've looked all over the internet and this site and have come up a loss with an easy way to make a bash script to do what I want to do. I have a file with a naming convention as follows: 2012-01-18 string of words here 123.jpg 2012-01-18 string of words here 1234.jpg 2012-01-18... (2 Replies)
Discussion started by: Buzzman25
2 Replies

8. UNIX for Advanced & Expert Users

How to replace last 8 digits?

Hi, How I can replace last 8 ZEROS with 22991231? 19523479811841494432A2013052700000000 19523479811730333980A2013052700000000 19523479811417044397A2013052700000000 19523479811205895810C2013010120130131 A9523479811205895810A2013020120130228 19523479811205895810I2013030120130331... (9 Replies)
Discussion started by: jnrohit2k
9 Replies

9. UNIX for Beginners Questions & Answers

sed / awk script to delete the two digits from first 3 digits

Hi All , I am having an input file as stated below 5728 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r03_q_reg_20_/Q 011 611 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r04_q_reg_20_/Q 011 3486... (4 Replies)
Discussion started by: kshitij
4 Replies
XML::Parser::LiteCopy(3pm)				User Contributed Perl Documentation				XML::Parser::LiteCopy(3pm)

NAME
XML::Parser::LiteCopy - Lightweight regexp-based XML parser SYNOPSIS
use XML::Parser::LiteCopy; $p1 = new XML::Parser::LiteCopy; $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::LiteCopy 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 CData Doctype Comment PI 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 PI See XMLDecl in XML::Parser for details, but also includes other processing instructions 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. Copyright (C) 2009 Cal Henderson. 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. Further modifications by Cal Henderson. perl v5.12.3 2011-06-05 XML::Parser::LiteCopy(3pm)
All times are GMT -4. The time now is 01:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy