Re: matching certain lines

2013-02-10 Thread Chris Stinemetz
On Sun, Feb 10, 2013 at 8:05 AM, Chris Stinemetz wrote: > To take this a step further. > > How would you go about creating a hash to sum up all the values in group > $3 utilizing the flip/flop operator and print the results of the key and > value with the key being group $2? > > This is what I cam

Re: matching certain lines

2013-02-10 Thread Chris Stinemetz
To take this a step further. How would you go about creating a hash to sum up all the values in group $3 utilizing the flip/flop operator and print the results of the key and value with the key being group $2? Thank you, Chris while( ) { if ( /0x3\|68\|/ .. /^#END/ ) { print if /\|

Re: matching certain lines

2013-02-10 Thread Chris Stinemetz
Thank you everyone for you help. -Chris On Sat, Feb 9, 2013 at 5:15 PM, Uri Guttman wrote: > On 02/09/2013 03:59 PM, John W. Krahn wrote: > > >> Let's re-factor that down to its essence: >> >> while ( ) { >> print if /\|68\|/; >> print "$1\t$2\t$3\n" if /(\|\d)\|(\d+)\|(\d+)/; >>

Re: matching certain lines

2013-02-09 Thread Uri Guttman
On 02/09/2013 03:59 PM, John W. Krahn wrote: Let's re-factor that down to its essence: while ( ) { print if /\|68\|/; print "$1\t$2\t$3\n" if /(\|\d)\|(\d+)\|(\d+)/; } Now we need to add something that starts at |68| and stops at #END: while ( ) { if ( /\|68\|/ .. /^#EN

Re: matching certain lines

2013-02-09 Thread timothy adigun
Hi, On Sat, Feb 9, 2013 at 6:06 PM, Chris Stinemetz wrote: > I would like to only work with the data that has a line with |68| in it > Does it mean even, that |68| can be anyway in the your data before any of the #END is reached? If yes, then I think you have been given a good solution. If not,

Re: matching certain lines

2013-02-09 Thread John W. Krahn
Chris Stinemetz wrote: I would like to only work with the data that has a line with |68| in it print that line and then print each subsequent lines in that match /\|7\|\d+\|\d+/ until #END is reached and then repeat for the rest of the input data. Below is what I have attempted. Thanks in adva

Re: matching certain lines

2013-02-09 Thread David Precious
On Sat, 9 Feb 2013 11:06:46 -0600 Chris Stinemetz wrote: > I would like to only work with the data that has a line with |68| in > it print that line and then print each subsequent lines in that match > /\|7\|\d+\|\d+/ until #END is reached and then repeat for the rest of > the input data. OTTOMH

Re: matching array elements from hash ?

2012-09-01 Thread Dr.Ruud
On 2012-08-20 00:18, John W. Krahn wrote: print map exists $stud{ $_ } ? "$_ = $stud{ $_ }\n" : (), @names; A map using a ternary with (), is like a grep: print "$_ = $stud{ $_ }\n" for grep exists $stud{ $_ }, @names; -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: matching array elements from hash ?

2012-08-20 Thread timothy adigun
Hi Andy, On 8/20/12, Andy Bach wrote: > On Sun, Aug 19, 2012 at 4:48 PM, timothy adigun <2teezp...@gmail.com> > wrote: >> foreach my $match_value ( sort keys %stud ) { >> print $match_value, "=", $stud{$match_value}, >> $/ if $match_value ~~ @names; >> } > > "smart match" is a Perl

Re: matching array elements from hash ?

2012-08-20 Thread timothy adigun
Hi, > Hi Tim, > > Thanks, i tried to run the code, but get the error as below. Any thing i am > missing line 17. What version of Perl are you using? For smart matching to work you must have Perl 5.10.1 Up (the 5.10.0 version behaved differently). > syntax error at ./match2.pl line 17, near "$m

Re: matching array elements from hash ?

2012-08-20 Thread Jim Gibson
The "smart match" operator (~~) was introduced in Perl 5.10. If you are using a Perl earlier than that, you will get a syntax error. See perldoc perl5100delta perldoc perlsyn and search for "Smart". -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: b

Re: matching array elements from hash ?

2012-08-20 Thread Andy Bach
On Sun, Aug 19, 2012 at 4:48 PM, timothy adigun <2teezp...@gmail.com> wrote: > foreach my $match_value ( sort keys %stud ) { > print $match_value, "=", $stud{$match_value}, > $/ if $match_value ~~ @names; > } "smart match" is a Perl 6 (though it probably back ported to a Perl 5 modul

Re: matching array elements from hash ?

2012-08-20 Thread jet speed
Thanks John, worked as a treat. Appreciate it. On Sun, Aug 19, 2012 at 11:18 PM, John W. Krahn wrote: > jet speed wrote: > >> Hi All, >> > > Hello, > > > Is there a way to find matching array elements from hash. >> >> ex: >> >> @names = ( abc. def. ghi, jky; ); >> >> %stud = ( >> " abc" =>"

Re: matching array elements from hash ?

2012-08-20 Thread jet speed
On Sun, Aug 19, 2012 at 10:48 PM, timothy adigun <2teezp...@gmail.com>wrote: > Hi, > > Please, Check my comments below. > > On 8/19/12, jet speed wrote: > > Hi All, > > > > Is there a way to find matching array elements from hash. > > > > ex: > > > > @names = ( abc. def. ghi, jky; ); > > The a

Re: matching array elements from hash ?

2012-08-19 Thread John W. Krahn
jet speed wrote: Hi All, Hello, Is there a way to find matching array elements from hash. ex: @names = ( abc. def. ghi, jky; ); %stud = ( " abc" =>" 34", "nba" =>"99", "def" =>"24", "ghi"=> "33"); How can i go throught each elements of has %stud and print the matching array value in th

Re: matching array elements from hash ?

2012-08-19 Thread timothy adigun
Hi, Please, Check my comments below. On 8/19/12, jet speed wrote: > Hi All, > > Is there a way to find matching array elements from hash. > > ex: > > @names = ( abc. def. ghi, jky; ); The above should be @names=("abc","def","ghi","jky"); OR @names=qw(abc def ghi jky); OR other variant

RE: Matching Greek letters in UTF-8 file

2011-10-10 Thread Hamann, T.D. (Thomas)
ey occur in two unique formats throughout the whole document (which should match \w- and -\w- ). Thomas Van: Brian Fraser [frase...@gmail.com] Verzonden: donderdag 29 september 2011 16:59 Aan: John Delacour CC: beginners@perl.org Onderwerp: Re: Matching G

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread John Delacour
At 17:29 -0300 29/9/11, Brian Fraser wrote: On Thu, Sep 29, 2011 at 4:03 PM, John Delacour wrote: Nitpick: Why the upper-case charset name? Uppercase is UTF-8-strict, while lowercase is the lax version that perl uses internally. Unless you are passing data from one perl program to anothe

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread Brian Fraser
On Thu, Sep 29, 2011 at 4:03 PM, John Delacour wrote: > > Nitpick: Why the upper-case charset name? > Uppercase is UTF-8-strict, while lowercase is the lax version that perl uses internally. Unless you are passing data from one perl program to another, and you are using illegal-UTF8-but-legal-UT

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread John Delacour
At 11:59 -0300 29/9/11, Brian Fraser wrote: On Thu, Sep 29, 2011 at 10:58 AM, John Delacour wrote: use encoding 'utf-8'; Nitpick: Please don't use this, as encoding is broken. use utf8; and use open qw< :std :encoding(UTF-8) >; should make do for a replacement. Nitpick: Why the upper-c

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread Brian Fraser
On Thu, Sep 29, 2011 at 10:58 AM, John Delacour wrote: > use encoding 'utf-8'; > > Nitpick: Please don't use this, as encoding is broken. use utf8; and use open qw< :std :encoding(UTF-8) >; should make do for a replacement. To the original poster, please note that there's a bit of a difference i

Re: Matching Greek letters in UTF-8 file

2011-09-29 Thread John Delacour
At 11:42 + 29/9/11, Hamann, T.D. (Thomas) wrote: I need to write a regex that matches any single Greek letter followed by a hyphen in a UTF-8 text file that is otherwise in English. How can I match the Greek alphabet (lower and upper case)? #!/usr/local/bin/perl use strict; use utf8; us

Re: matching/nesting anything

2010-09-27 Thread Shlomi Fish
On Monday 27 September 2010 12:21:51 hpant pant wrote: > Hi , > can anyone explain me, how below code works ,dealing with nested patterns. > i am not able to understand the ((?:(?!BEGIN)(?!END).)*) part. > > while (s/BEGIN((?:(?!BEGIN)(?!END).)*)END//gs) { > # do something with $1 >

Re: matching values of one hash to another

2010-04-29 Thread Harry Putnam
Jim Gibson writes: > The general advice is not to worry about execution time until it becomes an > issue. In other words, just get your program to do what you want it to do, > then try to speed it up only if it is taking too long. With that in mind... I'm back to spinning through the second hash

Re: matching values of one hash to another

2010-04-29 Thread Jim Gibson
On 4/29/10 Thu Apr 29, 2010 5:15 PM, "Harry Putnam" scribbled: >> >> The braces ({}) mean that %data is a "hash-of-hashes", i.e., the values of >> the elements of %data are references to hashes. > > Needless to say, I'm a bit confused here googling on `hash of > hashes' has plenty of hits

Re: matching values of one hash to another

2010-04-29 Thread Harry Putnam
Jim Gibson writes: [...] thanks for the tips on timing > The general advice is not to worry about execution time until it becomes an > issue. In other words, just get your program to do what you want it to do, > then try to speed it up only if it is taking too long. That sound sensible. [...]

Re: matching values of one hash to another

2010-04-29 Thread Jim Gibson
On 4/29/10 Thu Apr 29, 2010 2:06 PM, "Harry Putnam" scribbled: > "John W. Krahn" writes: > > [...] > >>> In other words is the perl interpreter working harder in one case? >> >> Yes. > > Thanks. Do you have any idea how much worse it is? > > I ask because I have some old scripts that go

Re: matching values of one hash to another

2010-04-29 Thread Harry Putnam
"John W. Krahn" writes: [...] >> In other words is the perl interpreter working harder in one case? > > Yes. Thanks. Do you have any idea how much worse it is? I ask because I have some old scripts that go spinning thru the whole hash in that same way, that I should probably track down and ch

Re: matching values of one hash to another

2010-04-29 Thread Harry Putnam
"Uri Guttman" writes: > again, why the poor names? what is 'base'? how is 1 different than 2? > you have yet to properly specify the PROBLEM. you keep talking about Easy up a little Uri... I hadn't seen your post when I wrote that response to John. -- To unsubscribe, e-mail: beginners-unsubsc

Re: matching values of one hash to another

2010-04-29 Thread John W. Krahn
Harry Putnam wrote: I posted my effort at digging out the matches. I see the way you did it, even though not the exact results I was after is 100s of percent better way to write it. I'm curious though if the overhead is different in your compact code compared to mine. That is, if all that

Re: matching values of one hash to another

2010-04-29 Thread Uri Guttman
> "HP" == Harry Putnam writes: HP> "John W. Krahn" writes: >>> I need to do some matching of filenames in two top level directories. >>> We expect to find a number of cases where the endnames ($_) are the >>> same in both hierarchies but the full name is different. >>> >>> base1

Re: matching values of one hash to another

2010-04-29 Thread Harry Putnam
"John W. Krahn" writes: >> I need to do some matching of filenames in two top level directories. >> We expect to find a number of cases where the endnames ($_) are the >> same in both hierarchies but the full name is different. >> >> base1/my/file >> base2/my/different_path/file This should h

Re: matching values of one hash to another

2010-04-29 Thread Uri Guttman
> "HP" == Harry Putnam writes: HP> I need to do some matching of filenames in two top level directories. HP> We expect to find a number of cases where the endnames ($_) are the HP> same in both hierarchies but the full name is different. someone else mentioned this but endname and full

Re: matching values of one hash to another

2010-04-28 Thread John W. Krahn
Harry Putnam wrote: I need to do some matching of filenames in two top level directories. We expect to find a number of cases where the endnames ($_) are the same in both hierarchies but the full name is different. base1/my/file base2/my/different_path/file I've made hashes of the file nam

Re: matching an element from one array to another

2009-12-10 Thread Philip Potter
2009/12/10 John W. Krahn : > Noah wrote: >> >> Hi there, > > Hello, > >> I am hoping to figure out the best Way to write something.  I have two >> arrays @previous_hostnames and @hostnames. >> >> I want to figure out if there is at least one matching element in >> @previous_hostnames that is found

Re: matching an element from one array to another

2009-12-09 Thread John W. Krahn
Rafa? Pocztarski wrote: I forgot to cc: the list... 2009/12/10 Noah : I am hoping to figure out the best Way to write something. Â I have two arrays @previous_hostnames and @hostnames. I want to figure out if there is at least one matching element in @previous_hostnames that is found in @hostn

Re: matching an element from one array to another

2009-12-09 Thread Uri Guttman
> "N" == Noah writes: N> Hi there, N> I am hoping to figure out the best Way to write something. I have two N> arrays @previous_hostnames and @hostnames. N> I want to figure out if there is at least one matching element in N> @previous_hostnames that is found in @hostnames. N>

Re: matching an element from one array to another

2009-12-09 Thread Rafał Pocztarski
I forgot to cc: the list... 2009/12/10 Noah : > I am hoping to figure out the best Way to write something.  I have two > arrays @previous_hostnames and @hostnames. > > I want to figure out if there is at least one matching element in > @previous_hostnames that is found in @hostnames. You can use

Re: matching an element from one array to another

2009-12-09 Thread John W. Krahn
Noah wrote: Hi there, Hello, I am hoping to figure out the best Way to write something. I have two arrays @previous_hostnames and @hostnames. I want to figure out if there is at least one matching element in @previous_hostnames that is found in @hostnames. my $found = map { my $x = $_;

Re: matching multi occurrences or nothing

2009-09-19 Thread John W. Krahn
Noah Garrett Wallach wrote: Hi there Perl folks, Hello, Okay I am trying to figure this out. I am trying to match the following: $line = "blah&blah&blah" so I have the following line to match that $line =~ /((?:blah).*?){0,5}/; But I want to capture "blah" in a variable like $capture =

Re: matching multi occurrences or nothing

2009-09-17 Thread Jim Bauer
Noah Garrett Wallach wrote on Thu, 17 Sep 2009 13:23:37 -0700 >Hi there Perl folks, > > >Okay I am trying to figure this out. > >I am trying to match the following: > > >$line = "blah&blah&blah" > > >so I have the following line to match that > >$line =~ /((?:blah).*?){0,5}/; >But I want to captu

Re: matching multi occurrences or nothing

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 16:23, Noah Garrett Wallach wrote: > Hi there Perl folks, > > > Okay I am trying to figure this out. > > I am trying to match the following: > > > $line = "blah&blah&blah" > > > so I have the following line to match that > > $line =~ /((?:blah).*?){0,5}/; > But I want to ca

RE: Matching Question

2009-06-02 Thread Farrell, Patrick
Saturday, May 30, 2009 3:49 AM To: Perl Beginners Subject: Re: Matching Question Farrell, Patrick wrote: > This is roughly what I am trying to do. Surround lower case strings within a > string with tags. > > === > $msgText=

Re: Matching Question

2009-06-01 Thread John W. Krahn
Farrell, Patrick wrote: Thanks. What if I added numbers like this $msgText =~ s!(?<= )([a-z,0-9]+)(?= )!$1!g; Did you really want to include a comma as part of that character class? But I didn't want a string of only numbers? In the strings I waned, I know the first character would not be

Re: Matching Question

2009-05-30 Thread John W. Krahn
Farrell, Patrick wrote: This is roughly what I am trying to do. Surround lower case strings within a string with tags. === $msgText="THIS IS MY test STRING"; $msgText =~ m/ [a-z]+ /; #or $msgText =~ /\s[a-z]+\s/; if(defined($1)){ That

Re: Matching Over Multiple Lines

2009-03-17 Thread John W. Krahn
Jeff Westman wrote: All, Hello, I know this has been asked many times, and I have read the documentation ("perldoc -q "matching over more than one line") and still can't make head or tails out of this. I have a problem where my pattern can be in one line, or span multiple lines. This is wha

Re: Matching Over Multiple Lines

2009-03-17 Thread Chas. Owens
On Tue, Mar 17, 2009 at 13:55, Bob McConnell wrote: > From: Chas. Owens >> >> Perl doesn't start having problems with files until you start getting >> into areas that the OS has problems with those files.  Your machine, >> however, may have problems if it does not have enough memory.  I >> remembe

RE: Matching Over Multiple Lines

2009-03-17 Thread Bob McConnell
From: Chas. Owens > > Perl doesn't start having problems with files until you start getting > into areas that the OS has problems with those files. Your machine, > however, may have problems if it does not have enough memory. I > remember working on a production machine that only had eight megab

Re: Matching Over Multiple Lines

2009-03-17 Thread Chas. Owens
On Tue, Mar 17, 2009 at 12:39, Jim Gibson wrote: snip > A file of length 10MB should be no problem for Perl. snip Perl doesn't start having problems with files until you start getting into areas that the OS has problems with those files. Your machine, however, may have problems if it does not ha

Re: Matching Over Multiple Lines

2009-03-17 Thread Jim Gibson
On 3/17/09 Tue Mar 17, 2009 8:45 AM, "Jeff Westman" scribbled: > All, > > I know this has been asked many times, and I have read the documentation > ("perldoc -q "matching over more than one line") and still can't make head > or tails out of this. > > I have a problem where my pattern can be

Re: Matching HTML tags with RegExp

2008-12-06 Thread Peter Scott
On Sun, 30 Nov 2008 02:51:57 +0200, Canol Gökel wrote: > My problem is to match HTML tags with RegExp. I managed to match > something like this, properly: > > la la la a paragraph bla bla bla another paragraph ya ya > ya > > But when nested, there arises problems: > > a paragraph bla bla bla la

Re: Matching HTML tags with RegExp

2008-11-30 Thread Mr. Shawn H. Corey
On Sun, 2008-11-30 at 02:51 +0200, Canol Gökel wrote: > How can one write an expression to match always the most inner part? I > couldn't write an expression like "match a non-greedy .* which > does not have a inside. > You can't write a regular expression to do this. And no, I'm not going to w

Re: Matching Weird Text Chars

2008-11-03 Thread Chas. Owens
On Mon, Nov 3, 2008 at 13:16, Kent, Mr. John, Contractor, Code 7500 <[EMAIL PROTECTED]> wrote: snip > In the text document they are written as > > Deg = ° > Apostrophe (') = <92> > Open quote (") = <93> > Closed quote (") = <94> snip How are you viewing the file? Most likely the <92> notation

Re: matching elements from array and print the results line by line from log file

2008-10-30 Thread Brian
slow_leaner wrote: On Oct 28, 2:51 pm, [EMAIL PROTECTED] (Andy Cravens) wrote: -Original Message- From: slow_leaner [mailto:[EMAIL PROTECTED] Sent: Tue 10/28/2008 11:58 AM To: [EMAIL PROTECTED] Subject: matching elements from array and print the results line by line from log file Hi, I

Re: matching elements from array and print the results line by line from log file

2008-10-30 Thread slow_leaner
On Oct 28, 2:51 pm, [EMAIL PROTECTED] (Andy Cravens) wrote: > -Original Message- > From: slow_leaner [mailto:[EMAIL PROTECTED] > Sent: Tue 10/28/2008 11:58 AM > To: [EMAIL PROTECTED] > Subject: matching elements from array and print the results line by line from > log file > > Hi, > I have

Re: matching elements from array and print the results line by line from log file

2008-10-28 Thread John W. Krahn
slow_leaner wrote: Hi, Hello, I have a list of element in array that I would like to match the pattern in logs file. I have hard time take element from array and matching it. More then weeks now and don't know where to find in man page. perldoc -q "How do I efficiently match many regular ex

RE: matching elements from array and print the results line by line from log file

2008-10-28 Thread Andy Cravens
-Original Message- From: slow_leaner [mailto:[EMAIL PROTECTED] Sent: Tue 10/28/2008 11:58 AM To: beginners@perl.org Subject: matching elements from array and print the results line by line from log file Hi, I have a list of element in array that I would like to match the pattern in lo

Re: matching lines in array - other ways to code

2008-09-10 Thread Mr. Shawn H. Corey
On Wed, 2008-09-10 at 18:14 -0700, Noah wrote: > Hi there, > > could somebody please suggest some other ways to simplify the reading > and perhaps make the following process quicker? I have a better example > now. > > print CHANGE "not sure\n" unless ( grep (/not\ssure/, @lines ) ); > print CHA

Re: matching lines in array - other ways to code

2008-09-10 Thread Paul Johnson
On Wed, Sep 10, 2008 at 06:37:31PM -0500, Wagner, David --- Senior Programmer Analyst --- WGO wrote: > > From: Noah [mailto:[EMAIL PROTECTED] > > > > could somebody please suggest some other ways to simplify the reading > > and perhaps make the following process quicker? > > > > > > print CHA

Re: matching lines in array - other ways to code

2008-09-10 Thread Noah
Wagner, David --- Senior Programmer Analyst --- WGO wrote: -Original Message- From: Noah [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 10, 2008 16:28 To: Perl Beginners Subject: matching lines in array - other ways to code Hi there, could somebody please suggest some other wa

RE: matching lines in array - other ways to code

2008-09-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Noah [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 10, 2008 16:28 > To: Perl Beginners > Subject: matching lines in array - other ways to code > > Hi there, > > could somebody please suggest some other ways to simplify the reading > and perhaps make

Re: matching ' in regx

2008-08-27 Thread Mr. Shawn H. Corey
On Tue, 2008-08-26 at 22:31 -0600, Dan Baker wrote: > There must be some really odd stuff going on with html encoding or regx! > Anyway, if I change my match to :: I can now catch the situation... not > that I understand how a ' gets changed to :: In Perl version 4, a single quote was use to de-re

Re: matching ' in regx

2008-08-27 Thread Jenda Krynicky
From: Dan Baker <[EMAIL PROTECTED]> > I have a thing driving me NUTS trying to detect a ' in a variable > with regex, and either strip it out or at least detect and error out. > for instance, this just does NOT work. DO NOT TEST FOR DANGEROUS CHARACTERS! MAKE SURE YOU ONLY HAVE THE SAFE ONE

Re: matching ' in regx

2008-08-26 Thread Dan Baker
Mr. Shawn H. Corey wrote: $UploadedImage = 'badname\'s.jpg' ; if ( $UploadedImage =~ m/'/ ) { ... How do I match the ' ? You match it exactly like you're doing. Since CGI is involved, I'd look elsewhere from the problem. Are you absolutely certain that some software between the browser a

Re: matching ' in regx

2008-08-26 Thread Mr. Shawn H. Corey
On Tue, 2008-08-26 at 17:59 -0600, Dan Baker wrote: > I have a thing driving me NUTS trying to detect a ' in a variable > with regex, and either strip it out or at least detect and error out. > for instance, this just does NOT work. > > $UploadedImage = 'badname\'s.jpg' ; > > if ( $Uploaded

RE: matching ' in regx

2008-08-26 Thread Wagner, David --- Senior Programmer Analyst --- WGO
From: Dan Baker [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2008 17:00 To: beginners@perl.org Subject: matching ' in regx I have a thing driving me NUTS trying to detect a ' in a variable with regex, and either strip it out or at least detect and error out. for instance, this just d

Re: matching ipaddress/netmask lines

2008-08-04 Thread John W. Krahn
Noah wrote: Okay, Hello, I need a bit of help here. OK, I'll try. there are thousands of lines in some files. True. I am trying to match the lines that have "address\s/" and save the IP to $loopback except if "lines" implies that the pattern can be found in more than one line? th

Re: matching lines like grep

2008-07-09 Thread Gunnar Hjalmarsson
Jay Savage wrote: On Tue, Jul 8, 2008 at 10:52 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: Rob Dixon wrote: Noah wrote: @config_file_lines = ; s/\s+$/\n/ foreach @config_file_lines; The newline is only necessary if you perform the substitution only on one set of records. If you also a

Re: matching lines like grep

2008-07-09 Thread Jay Savage
On Sun, Jul 6, 2008 at 6:57 PM, Noah <[EMAIL PROTECTED]> wrote: > Hi there fellow PERL coders. > > I am trying to match lines between a template file and a configuration file. > If the configuration is missing a particular line that is found in the > template file then it is printed. If the confi

Re: matching lines like grep

2008-07-09 Thread Jay Savage
On Tue, Jul 8, 2008 at 10:52 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Rob Dixon wrote: >> >> Noah wrote: >>> >>> Rob Dixon wrote: Then I guess you are processing a file that originated on a Windows system? Windows text files have a sequence at the end of each record,

Re: matching lines like grep

2008-07-08 Thread Rob Dixon
Gunnar Hjalmarsson wrote: > Rob Dixon wrote: >> Noah wrote: >>> Rob Dixon wrote: Then I guess you are processing a file that originated on a Windows system? Windows text files have a sequence at the end of each record, whereas Unix files have just . is control-M, which is wh

Re: matching lines like grep

2008-07-08 Thread Gunnar Hjalmarsson
Rob Dixon wrote: Noah wrote: Rob Dixon wrote: Then I guess you are processing a file that originated on a Windows system? Windows text files have a sequence at the end of each record, whereas Unix files have just . is control-M, which is why vim is showing ^M at the end of the line. What you

Re: matching lines like grep

2008-07-08 Thread Rob Dixon
Noah wrote: > Rob Dixon wrote: >> Noah wrote: >>> Rob Dixon wrote: Noah wrote: > let me put toether some bogus output files. You could just describe your output. Are you getting nothing at all? Or is it showing all lines of both files? Or none from one and all fr

Re: matching lines like grep

2008-07-08 Thread Noah
Rob Dixon wrote: Noah wrote: in line Below let me put toether some bogus output files. You could just describe your output. Are you getting nothing at all? Or is it showing all lines of both files? Or none from one and all from the other? Or just more or fewer lines than you think is correc

Re: matching lines like grep

2008-07-07 Thread John W. Krahn
Noah wrote: Hi there fellow PERL coders. Hello, I am trying to match lines between a template file and a configuration file. If the configuration is missing a particular line that is found in the template file then it is printed. If the configuration file has an extra line then it to gets

Re: matching lines like grep

2008-07-07 Thread Rob Dixon
Noah wrote: > in line Below > >>> let me put toether some bogus output files. >> >> You could just describe your output. Are you getting nothing at all? Or is it >> showing all lines of both files? Or none from one and all from the other? Or >> just more or fewer lines than you think is correct?

Re: matching lines like grep

2008-07-07 Thread Noah
in line Below let me put toether some bogus output files. (Please bottom-post your responses to this group. Thanks.) You could just describe your output. Are you getting nothing at all? Or is it showing all lines of both files? Or none from one and all from the other? Or just more or fewer l

Re: matching lines like grep

2008-07-06 Thread Rob Dixon
Noah wrote: > Rob Dixon wrote: >> Noah wrote: >>> Hi there fellow PERL coders. >>> >>> I am trying to match lines between a template file and a configuration >>> file. If the configuration is missing a particular line that is found >>> in the template file then it is printed. If the configurati

Re: matching lines like grep

2008-07-06 Thread Noah
I wish I could share the output. let me put toether some bogus output files. Cheers, Noah Rob Dixon wrote: Noah wrote: Hi there fellow PERL coders. I am trying to match lines between a template file and a configuration file. If the configuration is missing a particular line that is found

Re: matching lines like grep

2008-07-06 Thread Rob Dixon
Noah wrote: > Hi there fellow PERL coders. > > I am trying to match lines between a template file and a configuration > file. If the configuration is missing a particular line that is found > in the template file then it is printed. If the configuration file has > an extra line then it to get

Re: matching and parsing commands

2007-11-16 Thread Tom Phoenix
On 11/15/07, alok nath <[EMAIL PROTECTED]> wrote: >Is it possible to write some kind of grammars for the command and parse it > ? Probably. Have you seen Parse::RecDescent? http://search.cpan.org/dist/Parse-RecDescent/ Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe,

Re: Matching 5th and 6th characted

2007-10-11 Thread Paul Lalli
On Oct 11, 9:30 am, [EMAIL PROTECTED] wrote: > Think one of the column ($arcval) value is APBNSTWAP23. I wanted to take > lines from > the csv file for those columns whose value is ST for its 5th and 6th > character. How can > I implement this in perl using reg ex. Help needed. Why are you maki

Re: Matching 5th and 6th characted

2007-10-11 Thread manojkumarg
The is what I was looking for..Thanks All - Original Message - From: Jenda Krynicky <[EMAIL PROTECTED]> Date: Thursday, October 11, 2007 7:40 pm Subject: Re: Matching 5th and 6th characted To: beginners@perl.org > Date sent:Thu, 11 Oct 2007 18:30:26 +05

Re: Matching 5th and 6th characted

2007-10-11 Thread Jenda Krynicky
Date sent: Thu, 11 Oct 2007 18:30:26 +0500 From: [EMAIL PROTECTED] Subject:Matching 5th and 6th characted To: beginners@perl.org Priority: normal > Hello List, > > Struck up with a script in using regular expression.

Re: Matching 5th and 6th characted

2007-10-11 Thread Rob Dixon
[EMAIL PROTECTED] wrote: Hello List, Struck up with a script in using regular expression. There are 6000 lines in a csv file in which using an if conditon for a particular column. Think one of the column ($arcval) value is APBNSTWAP23. I wanted to take lines from the csv file for those columns

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Chas Owens
On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote: On Jun 1, 12:31 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > You might be able to get by with the code in the Perl Cookbook*. > > *PIRATED COPY OF COPYRIGHTED MATERIAL REMOVED Please don't do that again. On behalf of those who enjoy the works cre

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Paul Lalli
On Jun 1, 12:04 pm, [EMAIL PROTECTED] (Ben Edwards) wrote: > Thanks everybody for there help, did a little more dinging and came up with:- > > eval { > $ftp = Net::FTP->new( $remote_host ) or die "faild to connect to > $remote_host"; > $ftp->login( $remote_user, $remote_password ) o

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Mumia W.
On 06/01/2007 11:04 AM, Ben Edwards wrote: [...] The variable $flist has something like '*.cvs' in it which I guess is almost but not quite a regular expresion. Any idea how I can find out if $file matches the filename 'mask' $flist. Alternatively is there a way of doing a ls and specifying a f

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Paul Lalli
On Jun 1, 12:31 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > You might be able to get by with the code in the Perl Cookbook*. > > *PIRATED COPY OF COPYRIGHTED MATERIAL REMOVED Please don't do that again. On behalf of those who enjoy the works created by people who write them for a living, I thank

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Chas Owens
On 6/1/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 6/1/07, Ben Edwards <[EMAIL PROTECTED]> wrote: snip > The variable $flist has something like '*.cvs' in it which I guess is > almost but not quite a regular expresion. snip * in shell matching terms means .* in regex terms . in shell matching t

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread yitzle
I'm not sure how it works, but someone mentions using qr// instead of qw// or "" for setting a variable/string that is going to be used in a RegEx. Maybe look at http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators-operator%2c-quote-operator%2c-quote-like-q-qq-qx-qw-m--qr-s-tr-'-''

Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Chas Owens
On 6/1/07, Ben Edwards <[EMAIL PROTECTED]> wrote: snip The variable $flist has something like '*.cvs' in it which I guess is almost but not quite a regular expresion. snip * in shell matching terms means .* in regex terms . in shell matching terms means \. in regex terms cvs is the same Where

Re: matching labels

2007-05-17 Thread xavier mas
El Jueves 17 Mayo 2007 22:11, Dr.Ruud escribió: > xavier mas schreef: > > I have a little problem don't have how to solve regarding matching. I > > am working with xml files that contain labels marking the text inside > > them. > > Use an XML-parser. > http://search.cpan.org/search?m=module&q=XML+p

Re: matching labels

2007-05-17 Thread Dr.Ruud
xavier mas schreef: > I have a little problem don't have how to solve regarding matching. I > am working with xml files that contain labels marking the text inside > them. Use an XML-parser. http://search.cpan.org/search?m=module&q=XML+parse -- Affijn, Ruud "Gewoon is een tijger." -- To un

Re: matching labels

2007-05-17 Thread yitzle
I suppose you could use a stack object. Perl ought to have one... Check CPAN. A stack lets you push items on and pop them off. You can read a a tag. Its its an open tag, you push it to the stack. If its a close, you pop the top item and check it matches. On 5/17/07, xavier mas <[EMAIL PROTECTED]>

Re: Matching the domain of a URL

2007-03-15 Thread Igor Sutton Lopes
On 2007/03/15, at 18:29, Jenda Krynicky wrote: From: Igor Sutton Lopes <[EMAIL PROTECTED]> my @possible_values = qw{ http://www.google.com https://my.domain. http://some.other.domain.net }; my @urls = qw{ http://www.google.com/?some_bizarre_args https://my.domain.com https:

Re: Matching the domain of a URL

2007-03-15 Thread Grant
> I ended up going with this: > if ($Scratch->{url} =~ /^https?:\/\/images\.google\./) { > Does that look OK? Variant of your code: if ( $scratch->{url} =~ m#^https?://images\.google\.# ) { But you'd better go with Randal's "use URI;" advice. You're right, I hadn't grasped what URI was

Re: Matching the domain of a URL

2007-03-15 Thread Dr.Ruud
Grant schreef: > I ended up going with this: > if ($Scratch->{url} =~ /^https?:\/\/images\.google\./) { > Does that look OK? Variant of your code: if ( $scratch->{url} =~ m#^https?://images\.google\.# ) { But you'd better go with Randal's "use URI;" advice. -- Affijn, Ruud "Gewoon is

Re: Matching the domain of a URL

2007-03-15 Thread Grant
> > regex. > > if ( m/^https?\/\/:blah\.com/) > > > my @possible_values = qw{ >http://www.google.com >https://my.domain. >http://some.other.domain.net > }; > > my @urls = qw{ >http://www.google.com/?some_bizarre_args >https://my.domain.com >https://my.domain.net >http:

Re: Matching the domain of a URL

2007-03-15 Thread Jenda Krynicky
From: Igor Sutton Lopes <[EMAIL PROTECTED]> > On 2007/03/14, at 16:00, yitzle wrote: > > > regex. > > if ( m/^https?\/\/:blah\.com/) > > > my @possible_values = qw{ >http://www.google.com >https://my.domain. >http://some.other.domain.net > }; > > my @urls = qw{ >http://www.googl

  1   2   3   4   >