Re: Extracting value from regex

2016-06-09 Thread Shlomi Fish
Hi Punit, see below for my reply. On Thu, 9 Jun 2016 14:17:17 +0530 Punit Jain wrote: > Hi , > > Below is the problem I am facing : > > #!/usr/bin/perl > Always start your program with "use strict;" and "use warnings;" or equivalent. See: * http://perl-begin.org/tutorials/bad-elements/ >

Re: Extracting value from regex

2016-06-09 Thread Neil Bowers
Hi Punit, > /ldap:\/\/\/(.+)|mailto:(.+)/; > When i run this I get uid=user1,ou=People,o=test.com as > output however don't get y...@gmail.com printed. > The mailto is matched by $2, not $1. You can confirm this by changing your print line

Re: Extracting Columns from tab delimited files

2013-02-11 Thread Tiago Hori
Thanks, Jim. This awesome! T. Sent from my iPhone On 2013-02-11, at 11:49 AM, Jim Gibson wrote: > > On Feb 10, 2013, at 5:57 PM, Tiago Hori wrote: > >> Hi All, >> >> I am trying to force myself to not use one of perl's modules to parse tab >> delimited files (like TXT::CSV), so please be p

Re: Extracting Columns from tab delimited files

2013-02-11 Thread Jim Gibson
On Feb 10, 2013, at 5:57 PM, Tiago Hori wrote: > Hi All, > > I am trying to force myself to not use one of perl's modules to parse tab > delimited files (like TXT::CSV), so please be patient and don't tell me > just to go and use them. I am trying to re-ivent the wheel, so to speak, > because as

Re: Extracting Columns from tab delimited files

2013-02-10 Thread timothy adigun
Hi Hori, Please check below for my comments on your code. On 11 Feb 2013 03:00, "Tiago Hori" wrote: > > Hi All, > > I am trying to force myself to not use one of perl's modules to parse tab > delimited files (like TXT::CSV), so Are you referring to module Text::CSV and it's cousin Text::CSV_XS? pl

Re: extracting exif information from images

2012-02-11 Thread Harry Putnam
"John W. Krahn" writes: >> #!/usr/local/bin/perl >> >> use strict; >> use warnings; > > Could it be that your editor is putting a BOM as the first two > characters of your program? It never has before but if so would that show up using the `l' (ell) operator in sed? Or could a BOM sneak right by

Re: extracting exif information from images

2012-02-11 Thread John W. Krahn
Harry Putnam wrote: A brief aside to John K: Harry wrote: Outputs a mess: ./myscript t1.jpg , | sh: 1: Syntax error: Unterminated quoted string | sh: 1: ��:+Y�0y�: not found | sh: 1: �: not found | sh: 1: Syntax error: EOF in backquote substitution | | [...] ` [...] "John W.

Re: extracting exif information from images

2012-02-11 Thread Harry Putnam
Ken Slater writes: Harry wrote: >>  use Image::ExifTool qw(:Public); >> >>  # Simple procedural usage >> >>  # Get hash of meta information tag names/values from an image >>  $info = ImageInfo('a.jpg'); >> >>  # Object-oriented usage >> >>  # Create a new Image::ExifTool objec

Re: extracting exif information from images

2012-02-06 Thread John W. Krahn
Harry Putnam wrote: I've been looking around, googling for a way to extract exif info from images. There are many tools out there. But I wanted to fiddle with the information in very specific ways. I hit on the perl module: Image-ExifTool (Phil Harvey) on cpan. However I am apparently badly mi

Re: extracting exif information from images

2012-02-06 Thread Ken Slater
On Mon, Feb 6, 2012 at 6:59 AM, Harry Putnam wrote: > I've been looking around, googling for a way to extract exif info from > images. There are many tools out there.  But I wanted to fiddle with > the information in very specific ways. > > I hit on the perl module: Image-ExifTool (Phil Harvey) on

Re: extracting email addresses from a file

2011-12-06 Thread Brian Fraser
On Tue, Dec 6, 2011 at 2:38 PM, Randal L. Schwartz wrote: > > "Rob" == Rob Coops writes: > > Rob> The biggest problem with email addresses is that the rules of how an > email > Rob> address can be formatted are so relaxed and thus so complex that > there is > Rob> to the best of my knowledge

Re: extracting email addresses from a file

2011-12-06 Thread Randal L. Schwartz
> "Rob" == Rob Coops writes: Rob> The biggest problem with email addresses is that the rules of how an email Rob> address can be formatted are so relaxed and thus so complex that there is Rob> to the best of my knowledge not a single person that has ever managed to Rob> create a 100% correct

Re: extracting email addresses from a file

2011-11-29 Thread Rob Dixon
On 29/11/2011 15:13, Rajeev Prasad wrote: hello, i am trying to extract email address from a afile, but not quite succesful. here is what i have: the file: myterqlqt qntmrq Prqtesm qltul qzeez Smqik qltulqzee...@jmqil.com 976665 myterqlqt qntmrq Prqtesm teepqk Mittql teep...@jmqil.com 939383 O

Re: extracting email addresses from a file

2011-11-29 Thread Rajeev Prasad
thx Sheppy, good enough for me. i am a beginner in perl. From: Sheppy R To: Rob Coops Cc: Rajeev Prasad ; perl list Sent: Tuesday, November 29, 2011 9:54 AM Subject: Re: extracting email addresses from a file Couldn't you just use the non-white

Re: extracting email addresses from a file

2011-11-29 Thread Rob Coops
On Tue, Nov 29, 2011 at 4:54 PM, Sheppy R wrote: > Couldn't you just use the non-whitespace character to capture everything > before and after the @ symbol? > > s/^.*\s(\S+@\S+)\s.*$/$1/ > > > Yes you could of course but... this is why I was saying nearly no syntax checking... the minor check to

Re: extracting email addresses from a file

2011-11-29 Thread Sheppy R
Couldn't you just use the non-whitespace character to capture everything before and after the @ symbol? s/^.*\s(\S+@\S+)\s.*$/$1/

Re: extracting email addresses from a file

2011-11-29 Thread Rob Coops
On Tue, Nov 29, 2011 at 4:13 PM, Rajeev Prasad wrote: > hello, > > i am trying to extract email address from a afile, but not quite > succesful. here is what i have: > > the file: > myterqlqt qntmrq Prqtesm qltul qzeez Smqik qltulqzee...@jmqil.com 976665 > myterqlqt qntmrq Prqtesm teepqk Mittql t

Re: Extracting Data from PDF files

2011-03-03 Thread Joe
I basically run our pdfs through a pdf 2 txt converter and extract the data from the text files. It is pretty simple. On 3/3/2011 6:21 AM, Mike Blezien wrote: - Original Message - From: "shawn wilson" Cc: "Perl List" Sent: Thursday, March 03, 2011 6:04 AM Sub

Re: Extracting Data from PDF files

2011-03-03 Thread Mike Blezien
- Original Message - From: "shawn wilson" Cc: "Perl List" Sent: Thursday, March 03, 2011 6:04 AM Subject: Re: Extracting Data from PDF files On Mar 3, 2011 6:35 AM, "Mike Blezien" wrote: - Original Message - From: "shawn wilson" C

Re: Extracting Data from PDF files

2011-03-03 Thread shawn wilson
On Mar 3, 2011 6:35 AM, "Mike Blezien" wrote: > > - Original Message - From: "shawn wilson" > Cc: "Perl List" > Sent: Thursday, March 03, 2011 5:22 AM > Subject: Re: Extracting Data from PDF files > > > >> On Mar 3, 2011

Re: Extracting Data from PDF files

2011-03-03 Thread Mike Blezien
- Original Message - From: "shawn wilson" Cc: "Perl List" Sent: Thursday, March 03, 2011 5:22 AM Subject: Re: Extracting Data from PDF files On Mar 3, 2011 6:07 AM, "Mike Blezien" wrote: Hello, I posted a question earlier about creating a PDF fi

Re: Extracting Data from PDF files

2011-03-03 Thread shawn wilson
On Mar 3, 2011 6:07 AM, "Mike Blezien" wrote: > > Hello, > > I posted a question earlier about creating a PDF file from a PDF form submission which we now have working. We are able to create the PDF file to be attached to an email. > > The issue I'm having now is the ability to extract some specif

Re: Extracting properties from objects.

2011-01-24 Thread Ben Lavery
Hi Sean, In your given example, $l becomes a link object, so you go: $l->url(); to get the URL, for example. After using your code below, look at this page: http://search.cpan.org/~petdance/WWW-Mechanize-1.66/lib/WWW/Mechanize/Link.pm That will show you how to use $l. Hope that helps, Ben On 2

Re: extracting href parts

2008-10-04 Thread Rob Dixon
Ankur wrote: > > I am trying to develop an app for my website for which i need to get > the name of the Shows from http://tv.yahoo.com/listings. > > If you go over the code you can see that some of the rows have the > shows with hyperlink and others without. How do i get the Hyperlink > and the s

Re: extracting multiple statements ...

2008-09-23 Thread Sharan Basappa
On Mon, Sep 22, 2008 at 9:02 PM, Thomas Bätzler <[EMAIL PROTECTED]> wrote: > Hi, > > Sharan Basappa <[EMAIL PROTECTED]> asked: >> I have a code snippet as follows: >> >> keyword id1 = a x b x c; >> keyword id2 = c x d x e; >> >> I would like to extract strings "a x b x c" and "c x d x e". >> I know

Re: extracting multiple statements ...

2008-09-22 Thread Mr. Shawn H. Corey
On Mon, 2008-09-22 at 19:11 +0200, Dr.Ruud wrote: > "Mr. Shawn H. Corey" schreef: > > > my $text = undef; > > You don't trust much anymore I see. :-) Just because you're not paranoid doesn't mean computers don't hate me! -- Just my 0.0002 million dollars worth, Shawn Linux is obsolete

Re: extracting multiple statements ...

2008-09-22 Thread Dr.Ruud
"Mr. Shawn H. Corey" schreef: > my $text = undef; You don't trust much anymore I see. :-) -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: extracting multiple statements ...

2008-09-22 Thread John W. Krahn
Sharan Basappa wrote: Hi, Hello, I have a code snippet as follows: keyword id1 = a x b x c; keyword id2 = c x d x e; I would like to extract strings "a x b x c" and "c x d x e". I know I can loop through the code and extract the strings, but is there a RE that can do this with a single stat

RE: extracting multiple statements ...

2008-09-22 Thread Thomas Bätzler
Hi, Sharan Basappa <[EMAIL PROTECTED]> asked: > I have a code snippet as follows: > > keyword id1 = a x b x c; > keyword id2 = c x d x e; > > I would like to extract strings "a x b x c" and "c x d x e". > I know I can loop through the code and extract the strings, > but is there a RE that can

Re: extracting multiple statements ...

2008-09-22 Thread Mr. Shawn H. Corey
On Mon, 2008-09-22 at 20:37 +0530, Sharan Basappa wrote: > I have a code snippet as follows: > > keyword id1 = a x b x c; > keyword id2 = c x d x e; > > I would like to extract strings "a x b x c" and "c x d x e". I know I > can loop through the > code and extract the strings, but is there a RE t

Re: Extracting data from log and reformating

2008-08-19 Thread John W. Krahn
John W. Krahn wrote: Kashif Salman wrote: How can I capture "Start" as well? putting brackets around it like so doesn't work: /^(Start)/ && <> =~ /^(\d+)\/(\d+)\/(\d+)/ && print "$1=> 20$4-$2-$3"; I know it seems pointless to capture start but it doesn't always say "Start" so I want to capt

Re: Extracting data from log and reformating

2008-08-19 Thread John W. Krahn
Kashif Salman wrote: How can I capture "Start" as well? putting brackets around it like so doesn't work: /^(Start)/ && <> =~ /^(\d+)\/(\d+)\/(\d+)/ && print "$1=> 20$4-$2-$3"; I know it seems pointless to capture start but it doesn't always say "Start" so I want to capture it. for simplicity l

Re: Extracting data from log and reformating

2008-08-19 Thread Kashif Salman
On Fri, Aug 15, 2008 at 9:03 AM, Chris Charley <[EMAIL PROTECTED]> wrote: > On Wed, Aug 13, 2008 at 10:05 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: >> >> Kashif Salman wrote: >>> >>> Greetings, >>> Hello, >>> >>> I have a log file like so, and I am trying to get the date on the nex

Re: Extracting data from log and reformating

2008-08-15 Thread Chris Charley
On Wed, Aug 13, 2008 at 10:05 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: Kashif Salman wrote: Greetings, Hello, I have a log file like so, and I am trying to get the date on the next line after "Start..." line. So for the log below I'd like to get the output 04/06/05 05/06/05 06/06/05

Re: Extracting data from log and reformating

2008-08-14 Thread Kashif Salman
On Wed, Aug 13, 2008 at 10:05 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: > Kashif Salman wrote: > >> Greetings, >> > > Hello, > > I have a log file like so, and I am trying to get the date on the next >> line >> after "Start..." line. So for the log below I'd like to get the output >> >> 04/06/

Re: Extracting data from log and reformating

2008-08-13 Thread Kashif Salman
On Wed, Aug 13, 2008 at 10:05 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: > Kashif Salman wrote: > >> Greetings, >> > > Hello, > > I have a log file like so, and I am trying to get the date on the next >> line >> after "Start..." line. So for the log below I'd like to get the output >> >> 04/06/

Re: Extracting data from log and reformating

2008-08-13 Thread John W. Krahn
Kashif Salman wrote: Greetings, Hello, I have a log file like so, and I am trying to get the date on the next line after "Start..." line. So for the log below I'd like to get the output 04/06/05 05/06/05 06/06/05 But I also need to re-format that so the end result becomes: 2005-04-06 2005-

Re: Extracting data from a string

2008-03-15 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > $_ = "aaa_b_c_.ddd"; > ($a, $b, $c, $d, $e, $e) = (split /_|\./)[1,2,3,4,5,6]; > I am not getting the "aaa". I am getting b when I should be getting a. As mentioned already, you missed that indexes start at 0. Consider: my %data; my @keys = qw/a b c d e f/

Re: Extracting data from a string

2008-03-14 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hello Hello, I have a string that I am trying to parse out into separate variables. I am having problems getting the first field extracted. I want to extract fields using period (.) and underline (_) delimineters. Here is the string aaa_b_c_.ddd The string is c

Re: extracting values from split without using an array

2008-03-10 Thread Chas. Owens
On Mon, Mar 10, 2008 at 1:49 AM, Rodrick Brown <[EMAIL PROTECTED]> wrote: snip > For example if you we're only interested in fields 1,3, and 5 you > could do something like > ($field1,undef,$field3,undef,$field5) = split/.../; > > Or you can do something like (split//...)[3] snip You can also

Re: extracting values from split without using an array

2008-03-09 Thread J. Peng
On Mon, Mar 10, 2008 at 1:37 PM, igotux igotux <[EMAIL PROTECTED]> wrote: >I tried > split(/\s+/,$var)[1] which is not working as i expected. You may be moving from python,:) In perl you should say, (split /\s+/,$var)[1]; because split /\s+/$var returns a list, use () to enclose the list's sco

Re: extracting values from split without using an array

2008-03-09 Thread Rodrick Brown
On Mon, Mar 10, 2008 at 1:37 AM, igotux igotux <[EMAIL PROTECTED]> wrote: > Hi, > I want to extract values from split without defining an array. Say i want to > access second element in the split output :- split (/\s+/,$var) . I tried > split(/\s+/,$var)[1] which is not working as i expected. C

Re: extracting data from websites

2008-01-21 Thread jm
On Jan 21, 2008 12:39 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > On Jan 21, 2008 1:21 PM, jm <[EMAIL PROTECTED]> wrote: > > i need to extract data from websites, tracking the status of various > > shipments. i'm aware of the LWP module but wondered how many other > > modules may be useful. i've

Re: extracting data from websites

2008-01-21 Thread Chas. Owens
On Jan 21, 2008 1:21 PM, jm <[EMAIL PROTECTED]> wrote: > i need to extract data from websites, tracking the status of various > shipments. i'm aware of the LWP module but wondered how many other > modules may be useful. i've just glanced over the LWP documentation > (not in-depth at all yet) and

Re: extracting fields from a matching line

2007-12-04 Thread John W . Krahn
On Tuesday 04 December 2007 07:28, ciwei2103 wrote: > thans for the reply. > > I modify the program a bit , the $cmd output looks like: > >Ident Symbolic Numeric Slot Type Status > > DF-1A 01A 1 1 DISK Online > FA-4A 04A

Re: extracting fields from a matching line

2007-12-04 Thread ciwei2103
thans for the reply. I modify the program a bit , the $cmd output looks like: Ident Symbolic Numeric Slot Type Status DF-1A 01A 1 1 DISK Online FA-4A 04A 4 4 FibreChannel Online FA-13A13A 13 1

Re: extracting fields from a matching line

2007-11-29 Thread John W . Krahn
On Wednesday 28 November 2007 16:07, ciwei2103 wrote: > > Given a code segment: > > my $cmd = "/usr/symcli/bin/something"; > open (SYMCFG, " $cmd |" ) or die "cannot open $!\n"; > > while ( ) { > #print $_ if /FibreChannel Online$/ ; > # extract fields from the matching line > my ( $ident,

re: extracting fields from a matching line

2007-11-29 Thread ciwei2103
Given a code segment: my $cmd = "/usr/symcli/bin/something"; open (SYMCFG, " $cmd |" ) or die "cannot open $!\n"; while ( ) { #print $_ if /FibreChannel Online$/ ; # extract fields from the matching line my ( $ident, $fa , $type, $status ) = (split )[0,1,4,5] if / FibreChannel Online$/

Re: Extracting one record from multiple-records textfile

2007-11-28 Thread John W . Krahn
On Wednesday 28 November 2007 14:05, Giuseppe.G. wrote: > > On 28 Nov, 01:44, [EMAIL PROTECTED] (Jeff Pang) wrote: > > > > Just show another way to do it. > > > > use strict; > > > > local $/="\n\n"; > > while() { > > next unless /^DOC-START\n(.*?)\nDOC-END$/sm; > > my $content = $1; > >

Re: Extracting one record from multiple-records textfile

2007-11-28 Thread Giuseppe.G.
On 28 Nov, 01:44, [EMAIL PROTECTED] (Jeff Pang) wrote: > Hello, > > Just show another way to do it. > > use strict; > > local $/="\n\n"; > while() { > next unless /^DOC-START\n(.*?)\nDOC-END$/sm; > my $content = $1; > parse($content); > > } Thank you all for your answers. In particula

Re: Extracting one record from multiple-records textfile

2007-11-27 Thread John W . Krahn
On Tuesday 27 November 2007 11:29, Giuseppe.G. wrote: > Hello there. Hello, > I'm a real beginner and I was wondering if you could be > so kind to help me on this. > I have a text file, containing a number of varying length documents, > all tagged with DOC-START and DOC-END, structured as follows

Re: Extracting one record from multiple-records textfile

2007-11-27 Thread Jeff Pang
Hello, Just show another way to do it. use strict; local $/="\n\n"; while() { next unless /^DOC-START\n(.*?)\nDOC-END$/sm; my $content = $1; parse($content); } sub parse { my $c = shift; print length($c),"\n"; } __DATA__ DOC-START content of the document DOC-END DOC-START

Re: Extracting one record from multiple-records textfile

2007-11-27 Thread Tom Phoenix
On 11/27/07, Giuseppe.G. <[EMAIL PROTECTED]> wrote: > I have a text file, containing a number of varying length documents, > all tagged with DOC-START and DOC-END, structured as follows: > > > DOC-START > content of the document > DOC-END > I need to take every document and pass it to a parsing f

Re: Extracting file name from full name

2007-09-27 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hello Hello, I have a string that contains a full path and file name. What is the easiest way to extract the file name? For example the path is /dir1/dir2/dir3/file.txt. $ perl -le' use File::Basename; my $full_path = q[/dir1/dir2/dir3/file.txt]; my $file_name =

Re: extracting common substrings...

2006-12-12 Thread D. Bolliger
D. Bolliger am Mittwoch, 13. Dezember 2006 02:25: Sorry for answering my own post... [snipped] > The script contains a testcase with "long" strings, it takes 1.2 secs on my > old machine (the test case is certainly not a worst case scenario). [snipped] > ### Test case: > > my $pat=join '', 'hello

Re: extracting common substrings...

2006-12-12 Thread D. Bolliger
Tom Phoenix am Mittwoch, 13. Dezember 2006 02:32: > On 12/12/06, D. Bolliger <[EMAIL PROTECTED]> wrote: > > $found{$1}++ for ($s2=~/($search)/g); # although count not used > > below > > Didn't $search just come from the data? It's a string, not a pattern. > If it's got any metacharacters, it

Re: Re: extracting common substrings...

2006-12-12 Thread Tom Phoenix
On 12/12/06, D. Bolliger <[EMAIL PROTECTED]> wrote: $found{$1}++ for ($s2=~/($search)/g); # although count not used below Didn't $search just come from the data? It's a string, not a pattern. If it's got any metacharacters, it could break your pattern, or worse. Cheers! --Tom Phoenix S

Re: extracting common substrings...

2006-12-12 Thread D. Bolliger
Helliwell, Kim am Dienstag, 12. Dezember 2006 21:56: > Is there a function (perhaps in a library module) that would take two > strings and return the common substring (if any) contained in the > arguments? I've been looking for such a beast on CPAN, but no luck so > far. > > > > If not, I guess I h

Re: extracting common substrings...

2006-12-12 Thread John W. Krahn
Helliwell, Kim wrote: > Is there a function (perhaps in a library module) that would take two > strings and return the common substring (if any) contained in the > arguments? I've been looking for such a beast on CPAN, but no luck so > far. Perhaps this is what you require: http://search.cpan.org

Re: extracting common substrings...

2006-12-12 Thread Tom Phoenix
On 12/12/06, Helliwell, Kim <[EMAIL PROTECTED]> wrote: Is there a function (perhaps in a library module) that would take two strings and return the common substring (if any) contained in the arguments? You want the longest possible common substring? Or all of the longest ones, if there's more

Re: Extracting only images from a mime mail

2006-12-06 Thread Tom Phoenix
On 12/6/06, Nagrale, Ajay <[EMAIL PROTECTED]> wrote: My requirement is to extract only images from an multipart email. I could see perl package (MIME::Parser) related to extraction of various parts of a given mail (mail txt, attachments). It extracts all the parts from a given mail. I am not

Re: extracting several text from logs using regex

2006-09-15 Thread Dr.Ruud
Michael Alipio schreef: > A log file contains several of these lines: > > session.blablahbla > blablabla proto:6 blablabla srcip:90.0.0.1 blablabla > blablabla srcport:3243 blablabla dstport:23 blablabla > > session.blablahbla > blablabla proto:6 blablabla srcip:90.0.0.1 blablabla > blabla

Re: extracting several text from logs using regex

2006-09-15 Thread John W. Krahn
Michael Alipio wrote: > Hi, Hello, > A log file contains several of these lines: > > session.blablahbla > blablabla proto:6 blablabla srcip:90.0.0.1 blablabla > blablabla srcport:3243 blablabla dstport:23 blablabla > > session.blablahbla > blablabla proto:6 blablabla srcip:90.0.0.1 blab

Re: extracting several text from logs using regex

2006-09-15 Thread Mumia W.
On 09/14/2006 11:04 PM, Michael Alipio wrote: Hi, A log file contains several of these lines: session.blablahbla blablabla proto:6 blablabla srcip:90.0.0.1 blablabla blablabla srcport:3243 blablabla dstport:23 blablabla session.blablahbla blablabla proto:6 blablabla srcip:90.0.0.1 blab

Re: extracting line between words

2006-09-14 Thread John W. Krahn
John W. Krahn wrote: > [EMAIL PROTECTED] wrote: >> >>But the output is coming like this TheSunrisesintheeast >> >>But I want the output like this The Sun rises in the east > > my @line = "The Sun rises in > the east and "; > print join ' ', split ' ', $line[ 0 ]; print map { join(

Re: extracting line between words

2006-09-14 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > Hi Perlers... Hello, > I need to extract line between two words > > like > > > @line = "The Sun rises in > the east and "; > > Now I want to extract the line from The word to east > > For tht I am using the following code: > > #!

RE: extracting line between words

2006-09-14 Thread Nagasamudram, Prasanna Kumar
Hi Mayank Please add $\=" "; to your code as follows. $\ is the output field separator. #!/usr/bin/perl use warnings; use strict; my @line = "The Sun rises in the east and "; my $store; $\=" "; ## <- OUTPUT FIELD SEPERATOR## while(<@line>){ print if $_ =~ /The/ ..

Re: extracting line between words

2006-09-14 Thread Igor Sutton
while(<@line>){ print if $_ =~ /The/ .. /east/ ; I suggest this: print join " ", (grep { /The/ .. /east/ } <@line>); -- Igor Sutton Lopes t: +55 51 9627.0779 e: [EMAIL PROTECTED]

Re: extracting NAME and DESCRIPTION sections from pod text file

2006-08-13 Thread Ken Foskey
On Sun, 2006-08-13 at 10:48 -0500, Mumia W. wrote: > On 08/13/2006 08:36 AM, Ken Perl wrote: > > what's correct regular expression on extracting only NAME and > > DESCRIPTION section from pod text file? > > I have tried this, but failed! > > > > perl -e '$c=`pod2text /data/WebGUI/lib/WebGUI/User.p

Re: extracting NAME and DESCRIPTION sections from pod text file

2006-08-13 Thread Dr.Ruud
Mumia W. schreef: > Ken: >> what's correct regular expression on extracting only NAME and >> DESCRIPTION section from pod text file? >> I have tried this, but failed! >> >> perl -e '$c=`pod2text /data/WebGUI/lib/WebGUI/User.pm`;$c =~ >> s/(NAME.*)SYNOPSIS/$1/;print $c' > > foreach $_ (`pod2text /u

Re: extracting NAME and DESCRIPTION sections from pod text file

2006-08-13 Thread Mumia W.
On 08/13/2006 08:36 AM, Ken Perl wrote: what's correct regular expression on extracting only NAME and DESCRIPTION section from pod text file? I have tried this, but failed! perl -e '$c=`pod2text /data/WebGUI/lib/WebGUI/User.pm`;$c =~ s/(NAME.*)SYNOPSIS/$1/;print $c' foreach $_ (`pod2text /usr

Re: Extracting a Range of Lines

2006-06-04 Thread joseph
""Mr. Shawn H. Corey"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 2006-05-06 at 10:20 +0800, joseph wrote: >> @line = () if /^DATE:/; ## set array @line to an empty list if line begin >> DATE? > > Yes, this will clear out the previous record. > >> push @line, $_; ## th

Re: Extracting a Range of Lines

2006-06-04 Thread Mr. Shawn H. Corey
On Mon, 2006-05-06 at 10:20 +0800, joseph wrote: > @line = () if /^DATE:/; ## set array @line to an empty list if line begin > DATE? Yes, this will clear out the previous record. > push @line, $_; ## then push the value of line to an empty @line array? @line is empty only if this is the first

Re: Extracting a Range of Lines

2006-06-04 Thread joseph
""Mr. Shawn H. Corey"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 2006-05-06 at 08:51 +0800, joseph wrote: >> Hello List, >> >> I need help in extracting a range of lines from a log files, i tried to >> do >> it with this script: >> >> >> #!/bin/perl >> >> use strict

Re: Extracting a Range of Lines

2006-06-04 Thread Mr. Shawn H. Corey
On Mon, 2006-05-06 at 08:51 +0800, joseph wrote: > Hello List, > > I need help in extracting a range of lines from a log files, i tried to do > it with this script: > > > #!/bin/perl > > use strict; > use warnings; > > open(FILE,"/home/teragram/status_log.txt") or die "can't open file $!\n"

Re: Extracting a bit of a scalar variable

2006-04-21 Thread Jaime Murillo
On Friday 21 April 2006 10:15, Smith, Derek wrote: > -Original Message- > From: Smith, Derek > Sent: Friday, April 21, 2006 10:22 AM > To: Perl Beginners > Subject: RE: Extracting a bit of a scalar variable > > > Original Message- > From: Dr.Ruud [mail

RE: Extracting a bit of a scalar variable

2006-04-21 Thread Smith, Derek
-Original Message- From: Smith, Derek Sent: Friday, April 21, 2006 10:22 AM To: Perl Beginners Subject: RE: Extracting a bit of a scalar variable Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Friday, April 21, 2006 9:19 AM To: beginners@perl.org Subject: Re

RE: Extracting a bit of a scalar variable

2006-04-21 Thread Smith, Derek
Original Message- From: Dr.Ruud [mailto:[EMAIL PROTECTED] Sent: Friday, April 21, 2006 9:19 AM To: beginners@perl.org Subject: Re: Extracting a bit of a scalar variable Praveena Vittal schreef: > I am newbie to PERL. ITYM: Perl. > I think this is a very simple question to ask.

Re: Extracting a bit of a scalar variable

2006-04-21 Thread Dr.Ruud
Praveena Vittal schreef: > I am newbie to PERL. ITYM: Perl. > I think this is a very simple question to ask. Well, let's see. > Is there any way to print a particular bit of a digit after converting > to binary form. Why convert anything "to binary" first, if you can use "$var & (1 << $bitp

Re: Extracting a bit of a scalar variable

2006-04-21 Thread Xavier Noria
On Apr 21, 2006, at 20:59, Praveena Vittal wrote: Is there any way to print a particular bit of a digit after converting to binary form. That can be easily done with substr y sprintf, this would take the second bit of 7 written in base 2: % perl -wle 'print substr sprintf("%b", 7), -2,

Re: Extracting a bit of a scalar variable

2006-04-20 Thread nishanth ev
Hello Praveena, I recommend you to use pack and unpack function. I believe you can use this to convert the digit to binary and also extract the digit of your choice from the result. perldoc -f pack type this command at your linux console if any to get the help on pack. Regards Nishanth --- Prav

Re: Extracting variables from a string

2006-04-18 Thread John W. Krahn
John W. Krahn wrote: > Ed wrote: >>How would I get the various elements out of a string of known format. >>A previous post about a similar topic approaches a solution but I need >>help with the regular expression to pass to the m function. >> >>Here's an example of a string: >>net user cknotts some

Re: Extracting variables from a string

2006-04-18 Thread John W. Krahn
Ed wrote: > How would I get the various elements out of a string of known format. > A previous post about a similar topic approaches a solution but I need > help with the regular expression to pass to the m function. > > Here's an example of a string: > net user cknotts somepassword /add /active:y

Re: Extracting variables from a string

2006-04-18 Thread Joshua Colson
On Tue, 2006-04-18 at 11:20 -0600, Ed wrote: > How would I get the various elements out of a string of known format. > A previous post about a similar topic approaches a solution but I need > help with the regular expression to pass to the m function. > > Here's an example of a string: > net user

Re: extracting information from a file

2006-02-03 Thread Mazhar
Hi Rana, if the data what you need is something xxxzzz>f then you can take the entry before > by the following code $x=xxxzzz>f ($data_required,$data_notrequired)=split($x,">"). Hope the above will solve the problem. Cheers Mazhar On 2/3/06, Dhanashri Bhate

RE: extracting information from a file

2006-02-02 Thread Dhanashri Bhate
Hi, Give the sample data and then only one can tell what kind of regex you need. If your data is simple, just fields delimited by ">" you don't need to write regex, you can just work with "split". Read the data lines one by one, and for each line use split to get the fields in an array. Also rememb

RE: extracting substrings from string using regexp

2005-12-13 Thread Dhanashri Bhate
s... It keeps the exams first and then teaches the lessons. -Original Message- From: Pant, Hridyesh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 13, 2005 12:31 PM To: Xavier Noria Cc: Perl Beginners Subject: RE: extracting substri

RE: extracting substrings from string using regexp

2005-12-13 Thread Timothy Johnson
works better. -Original Message- From: Pant, Hridyesh [mailto:[EMAIL PROTECTED] Sent: Monday, December 12, 2005 11:13 PM To: Owen Cook Cc: Perl Beginners Subject: RE: extracting substrings from string using regexp Hi Owen, But in windows when I am trying to install Module YAPE::Regex

RE: extracting substrings from string using regexp

2005-12-13 Thread Owen Cook
On Tue, 13 Dec 2005, Pant, Hridyesh wrote: > But in windows when I am trying to install Module YAPE::Regex I am > getting below error > Can't call method "ok" on an undefined value at > > C:/Perl/site/lib/PPM/UI.pm line 881, <$__ANONIO__> line 17 Sorry, I can't help you with Windows. Also

RE: extracting substrings from string using regexp

2005-12-12 Thread Pant, Hridyesh
om: Owen Cook [mailto:[EMAIL PROTECTED] Sent: 13 December 2005 12:37 To: Perl Beginners Subject: RE: extracting substrings from string using regexp On Tue, 13 Dec 2005, Pant, Hridyesh wrote: > Hi, > I have successfully installed YAPE::Regex::Explain,but when I try to run > ant regex program

RE: extracting substrings from string using regexp

2005-12-12 Thread Owen Cook
On Tue, 13 Dec 2005, Pant, Hridyesh wrote: > Hi, > I have successfully installed YAPE::Regex::Explain,but when I try to run > ant regex program I got below error > > Can't locate YAPE/Regex.pm in @INC (@INC contains: > C:\PROGRA~1\LUCKAS~1\ENGINS~2\ C:/Perl/lib C:/Perl/site/lib .) at > C:/Perl/

RE: extracting substrings from string using regexp

2005-12-12 Thread Pant, Hridyesh
80 (Bad hostname 'ppm.ActiveState.com') Could anybody suggest me how can I install YAPE::regex module successfully. Thanks Hridyesh -Original Message- From: Xavier Noria [mailto:[EMAIL PROTECTED] Sent: 13 December 2005 03:07 To: Perl Beginners Subject: Re: extracting sub

Re: extracting substrings from string using regexp

2005-12-12 Thread Owen Cook
On Mon, 12 Dec 2005, Xavier Noria wrote: > On Dec 12, 2005, at 22:10, Owen wrote: > > > Xavier Noria wrote: > >> On Dec 12, 2005, at 11:10, Alexandre Checinski wrote: > > > >>> I have a string that looks like this : > >>> >>> name="pcmTcuFaultOutOfService"/> > > > >> > >> m// in list contex may

Re: extracting substrings from string using regexp

2005-12-12 Thread John Doe
Owen am Montag, 12. Dezember 2005 22.10: > Xavier Noria wrote: > > On Dec 12, 2005, at 11:10, Alexandre Checinski wrote: > >> I have a string that looks like this : > >> >> name="pcmTcuFaultOutOfService"/> > > > > m// in list contex may help: > > > > my ($id, $name) = $xml =~ m{id="([^"]*)".*n

Re: extracting substrings from string using regexp

2005-12-12 Thread Xavier Noria
On Dec 12, 2005, at 22:10, Owen wrote: Xavier Noria wrote: On Dec 12, 2005, at 11:10, Alexandre Checinski wrote: I have a string that looks like this : m// in list contex may help: my ($id, $name) = $xml =~ m{id="([^"]*)".*name="([^"]*)"/>}; I despair of ever understanding REs

Re: extracting substrings from string using regexp

2005-12-12 Thread Owen
Xavier Noria wrote: > On Dec 12, 2005, at 11:10, Alexandre Checinski wrote: >> I have a string that looks like this : >> > name="pcmTcuFaultOutOfService"/> > > m// in list contex may help: > > my ($id, $name) = $xml =~ m{id="([^"]*)".*name="([^"]*)"/>}; I despair of ever understanding REs

Re: extracting substrings from string using regexp

2005-12-12 Thread Shawn Corey
Ing. Branislav Gerzo wrote: you should learn regexpes, they are very powerful. perldoc perlre See also: perldoc perlrequick Perl regular expressions quick start perldoc perlretut Perl regular expressions tutorial -- Just my 0.0002 million dollars worth, --- Shawn

Re: extracting substrings from string using regexp

2005-12-12 Thread Xavier Noria
On Dec 12, 2005, at 11:10, Alexandre Checinski wrote: hello everyone, I have a simple question. I have a string that looks like this : name="pcmTcuFaultOutOfService"/> and I would like to store the values for id and name in two different variables. I know how to do it using regexp. But the wa

Re: extracting substrings from string using regexp

2005-12-12 Thread Ing. Branislav Gerzo
Alexandre Checinski [AC], on Monday, December 12, 2005 at 11:10 (+0100) wrote: from head: my $string = ''; my ($id, $name) = $string =~ /id="(\d+)".*?name="([^"]+)"/; AC> PS: I'm a total newbie... you should learn regexpes, they are very powerful. perldoc perlre For parsing XMl files use some

RE: Extracting Upper case letter from a variable

2005-10-05 Thread Bernard Kenik
- Original Message - MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_=_NextPart_001_01C5C99A.9531A0CC" Subject: RE: Extracting Upper case letter from a variable Date: Wed, 5 Oct 2005 12:50:21 +0200 Message-ID: <[EMAIL PROTECTED]> From

  1   2   3   4   >