Re: Perl Regex with unix grep command

2011-09-03 Thread Shlomi Fish
Hi all, On Sat, 03 Sep 2011 17:15:51 -0400 Shawn H Corey wrote: > On 11-09-03 05:01 PM, Jon Forsyth wrote: > > Hello, > > > > According to the grep manual page I can use the -P option to use Perl > > regular expressions as follows: > > > > grep -P PERL_REGEX INPUT_FILE > > > > however, I cannot

Re: Perl Regex with unix grep command

2011-09-03 Thread Uri Guttman
> "JF" == Jon Forsyth writes: JF> According to the grep manual page I can use the -P option to use JF> Perl regular expressions as follows: JF> grep -P PERL_REGEX INPUT_FILE just to let you know, nothing but perl can run perl regexes. all the ones that claim it are doing subsets and

Re: Perl Regex with unix grep command

2011-09-03 Thread Shawn H Corey
On 11-09-03 05:01 PM, Jon Forsyth wrote: Hello, According to the grep manual page I can use the -P option to use Perl regular expressions as follows: grep -P PERL_REGEX INPUT_FILE however, I cannot get the following pattern to match a literal dollar sign: grep -P makan\$ file.txt # You ha

Perl Regex with unix grep command

2011-09-03 Thread Jon Forsyth
Hello, According to the grep manual page I can use the -P option to use Perl regular expressions as follows: grep -P PERL_REGEX INPUT_FILE however, I cannot get the following pattern to match a literal dollar sign: grep -P makan\$ file.txt when I know this pattern is in the file. It matches

Re: How does grep command compare a hash element with an array ofhash references?

2010-09-26 Thread Dr.Ruud
On 2010-09-25 13:07, John W. Krahn wrote: Dr.Ruud wrote: On 2010-09-25 01:57, Vaishnavi Saba wrote: My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). = @common = inter( \%foo, \%bar, \%joe ); sub inter { m

Re: How does grep command compare a hash element with an array of hash references?

2010-09-25 Thread John W. Krahn
Dr.Ruud wrote: On 2010-09-25 01:57, Vaishnavi Saba wrote: My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). = @common = inter( \%foo, \%bar, \%joe ); sub inter { my %seen; for my $href ( @_ ) { while (my $

Re: How does grep command compare a hash element with an array of hash references?

2010-09-25 Thread Dr.Ruud
On 2010-09-25 01:57, Vaishnavi Saba wrote: My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). = @common = inter( \%foo, \%bar, \%joe ); sub inter { my %seen; for my $href ( @_ ) { while (m

Re: How does grep command compare a hash element with an array of hash references?

2010-09-24 Thread Erez Schatz
On 09/25/2010 01:57 AM, Vaishnavi Saba wrote: > @common = inter( \%foo, \%bar, \%joe ); > sub inter { > my %seen; > for my $href (@_) { > while (my $k = each %$href ) { > $seen{$k}++; > } > } > return grep { $seen{$_} == @_ } keys %seen; > } Usually not a go

Re: How does grep command compare a hash element with an array of hash references?

2010-09-24 Thread John W. Krahn
Vaishnavi Saba wrote: Hi, Hello, My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). An array in scalar context returns the number of elements in the array and @_ (which is an alias to @common) contains 3 element

How does grep command compare a hash element with an array of hash references?

2010-09-24 Thread Vaishnavi Saba
Hi, My query: In the code shown below, How does *grep* compare a scalar( * $seen{$_}* ) with an array of hash references ( *...@_* ). = @common = inter( \%foo, \%bar, \%joe ); sub inter { my %seen; for my $href (@_) { while (my $k = each %$href ) { $seen{$k}++;

Re: grep command

2001-11-08 Thread eventualdeath
't find your match in the file.\n"; }; - Original Message - From: "Rajeev Nalluri" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, November 09, 2001 12:48 AM Subject: grep command > > Is there any grep commandto search inside a file? perl

Re: grep command

2001-11-08 Thread Brett W. McCoy
On Thu, 8 Nov 2001, Rajeev Nalluri wrote: > Is there any grep commandto search inside a file? perldoc grep gives a grep > command on a string, not files. > > And also I cannot use either backticks or system to use unix grep command. > I want to know is there any perl function to h

grep command

2001-11-08 Thread Rajeev Nalluri
Is there any grep commandto search inside a file? perldoc grep gives a grep command on a string, not files. And also I cannot use either backticks or system to use unix grep command. I want to know is there any perl function to handle grep in a file. Regards, Rajeev Nalluri -- To