split regex

2015-03-19 Thread Danny Wong (dannwong)
Hi Perl GURU,
I have a string like this:

'Baseline: (_bMgvUBQ_EeKsP6DECdq0Lg) 1 "Initial Baseline" "Initial Baseline of 
Component NGP-Diagnostics" Sivakumar Subas Oct 12, 2012 12:35:41 AM';

I’m trying to perform a split via \s (spaces) delimiter, but this give me a 
partial return of "Initial Baseline” (returns Initial). Is there a regex where 
I can split using space as the delimiter, but get all the words inside a quote 
string?


split regex

2005-12-15 Thread Umesh T G
Hi List,

I want to get that value of *-i* set in below line.

*Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*

What is the best way to get the value of *-i* values into one array.  For
ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into one array.

Thanks in advance.

Thanks
Umesh


Re: split regex

2015-03-19 Thread Danny Wong (dannwong)
Nevermind. I used regex to accomplish what I wanted instead of the split 
command. Thanks guys!

From: Danny H Wong mailto:dannw...@cisco.com>>
Date: Thursday, March 19, 2015 at 2:25 PM
To: Perl List mailto:beginners@perl.org>>, Perl Beginners 
mailto:beginners@perl.org>>
Subject: split regex

Hi Perl GURU,
I have a string like this:

'Baseline: (_bMgvUBQ_EeKsP6DECdq0Lg) 1 "Initial Baseline" "Initial Baseline of 
Component NGP-Diagnostics" Sivakumar Subas Oct 12, 2012 12:35:41 AM';

I’m trying to perform a split via \s (spaces) delimiter, but this give me a 
partial return of "Initial Baseline” (returns Initial). Is there a regex where 
I can split using space as the delimiter, but get all the words inside a quote 
string?


Re: split regex

2015-03-20 Thread Shlomi Fish
Hi Danny,

On Thu, 19 Mar 2015 21:42:53 +
"Danny Wong (dannwong)"  wrote:

> Nevermind. I used regex to accomplish what I wanted instead of the split
> command. Thanks guys!
> 

Just a note in general:  sometimes when a simple split or a regex match fails
you may opt to employ more complex parsing strategies. These are covered here:

http://perl-begin.org/uses/text-parsing/

Regards,

Shlomi Fish 
-- 
-
Shlomi Fish   http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

Shania Twain was much impressed by Chuck Norris.
— http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: split regex

2015-03-21 Thread Brandon McCaig
Danny Wong:

Hello,

On Thu, Mar 19, 2015 at 09:25:02PM +, Danny Wong (dannwong) wrote:
> Hi Perl GURU, I have a string like this:
> 
> 'Baseline: (_bMgvUBQ_EeKsP6DECdq0Lg) 1 "Initial Baseline"
> "Initial Baseline of Component NGP-Diagnostics" Sivakumar Subas
> Oct 12, 2012 12:35:41 AM';
> 
> I’m trying to perform a split via \s (spaces) delimiter, but
> this give me a partial return of "Initial Baseline” (returns
> Initial). Is there a regex where I can split using space as the
> delimiter, but get all the words inside a quote string?

It seems that you have figured this out by yourself, but a few
tips for future reference:

You may wish to configure your mail user agent (client) to send
plain text E-mails instead of HTML. I believe that many of us
prefer it. You should also learn how to properly send plain text
E-mails and generally proper netiquette for mailing list usage
(it varies list to list, and I don't know that this is a hard
"rule" here, but IMO it would help).

On that same note, avoid using "rich text" styling to communicate
ideas because not all readers will be able to see it. It appears
that you tried to color parts of the text in red to emphasis
them. I didn't see this from mutt where I normally read mailing
list posts. I noticed it when I happened to open the same thread
from the Gmail Web interface.

Lastly, if you're having trouble with Perl code it is always a
good idea to post the code you're struggling with. It's a little
bit difficult to understand what you were having trouble with,
but if you had posted code then there would have been several
anxious persons able to spot the problem and rushing to be the
first to reply. :)

Regards,


-- 
Brandon McCaig  
Castopulence Software 
Blog 
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'



signature.asc
Description: Digital signature


Re: split regex

2005-12-15 Thread John Doe
Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> Hi List,

Hi Umesh 

> I want to get that value of *-i* set in below line.
>
> *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*
>
> What is the best way to get the value of *-i* values into one array.  For
> ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into one array.

What possibilities did you try (show us some code), from which the best 
could be choosed, or to which a better could be added?

joe

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: split regex

2005-12-15 Thread Umesh T G
Hi John,

I tried like this,   where $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2"
-k -p -i"dir3\dir4" -m'*



if (grep/^Options/,$line)
{

@inc=split(/-i/,$line);

foreach $word (@inc)
{
print "$word\n";
}



I do not know how to proceed after this.


Thanks for your quick reply...



Thanks
Umesh




On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
>
> Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > Hi List,
>
> Hi Umesh
>
> > I want to get that value of *-i* set in below line.
> >
> > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*
> >
> > What is the best way to get the value of *-i* values into one
> array.  For
> > ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into one
> array.
>
> What possibilities did you try (show us some code), from which the best
> could be choosed, or to which a better could be added?
>
> joe
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>


Re: split regex

2005-12-15 Thread John Doe
Umesh T G am Donnerstag, 15. Dezember 2005 14.20:
> Hi John,

Hi Umesh

> I tried like this,   where $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2"
> -k -p -i"dir3\dir4" -m'*
>
>
>
> if (grep/^Options/,$line)
> {
>
> @inc=split(/-i/,$line);
>
> foreach $word (@inc)
> {
> print "$word\n";
> }
>
>
>
> I do not know how to proceed after this.
> Thanks for your quick reply...

You're welcome...

try the following:

a) put 
   use strict;
   use warnings;
at the beginning of the script

b) look at the warnings and then declare the vars with my, see
perldoc -f my

c)
read the documentation
perldoc -f grep
to see why grep is not appropriate in the if clause

d) check the documentation
perldoc -f perlre
and the others mentioned at the bottom to see why
/^Options/ won't ever match a string beginning with '*' and why your script 
doesn't print anything

e) hint:
don't use if, only use a regex to extract the parts you like, and extract them 
directly  into an array by catching the parts you like

... and post the new code then :-)

greetings joe



>
>
>
> Thanks
> Umesh
>
> On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > > Hi List,
> >
> > Hi Umesh
> >
> > > I want to get that value of *-i* set in below line.
> > >
> > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*
> > >
> > > What is the best way to get the value of *-i* values into one
> >
> > array.  For
> >
> > > ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into one
> >
> > array.
> >
> > What possibilities did you try (show us some code), from which the best
> > could be choosed, or to which a better could be added?
> >
> > joe
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: split regex

2005-12-15 Thread Umesh T G
Hi Joe,

just to correct my prevoius one,  my $line does not have * in the begining,
that was a type.  the $line value is like this

*Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m*



my grep return the values correct to my array and the values in array will
be like this obviously:

*Options=-a"hello" -mt -ml3 *
*"dir1\dir2"-k -p *
*"dir3\dir4" -m*
**
**
But, what I'm interested in getting the output values are:
*"dir1\dir2"*
*"dir3\dir4"*

I do not know how to get them..can u suggest pls.?


thanks
Umesh
**

**
**






On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
>
> Umesh T G am Donnerstag, 15. Dezember 2005 14.20:
> > Hi John,
>
> Hi Umesh
>
> > I tried like this,   where $line='*Options=-a"hello" -mt -ml3
> -i"dir1\dir2"
> > -k -p -i"dir3\dir4" -m'*
> >
> >
> >
> > if (grep/^Options/,$line)
> > {
> >
> > @inc=split(/-i/,$line);
> >
> > foreach $word (@inc)
> > {
> > print "$word\n";
> > }
> >
> >
> >
> > I do not know how to proceed after this.
> > Thanks for your quick reply...
>
> You're welcome...
>
> try the following:
>
> a) put
>   use strict;
>   use warnings;
> at the beginning of the script
>
> b) look at the warnings and then declare the vars with my, see
> perldoc -f my
>
> c)
> read the documentation
> perldoc -f grep
> to see why grep is not appropriate in the if clause
>
> d) check the documentation
> perldoc -f perlre
> and the others mentioned at the bottom to see why
> /^Options/ won't ever match a string beginning with '*' and why your
> script
> doesn't print anything
>
> e) hint:
> don't use if, only use a regex to extract the parts you like, and extract
> them
> directly  into an array by catching the parts you like
>
> ... and post the new code then :-)
>
> greetings joe
>
>
>
> >
> >
> >
> > Thanks
> > Umesh
> >
> > On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > > > Hi List,
> > >
> > > Hi Umesh
> > >
> > > > I want to get that value of *-i* set in below line.
> > > >
> > > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*
> > > >
> > > > What is the best way to get the value of *-i* values into one
> > >
> > > array.  For
> > >
> > > > ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into one
> > >
> > > array.
> > >
> > > What possibilities did you try (show us some code), from which the
> best
> > > could be choosed, or to which a better could be added?
> > >
> > > joe
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >  
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>


Re: split regex

2005-12-15 Thread Shawn Corey

Umesh T G wrote:

I tried like this,   where $line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2"
-k -p -i"dir3\dir4" -m'*



This line won't compile. Which of the following is it?

$line='Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m';

$line='*Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*';

Please test your code before posting.


--

Just my 0.0002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: split regex

2005-12-15 Thread Shawn Corey

Umesh T G wrote:

Hi Joe,

just to correct my prevoius one,  my $line does not have * in the begining,
that was a type.  the $line value is like this

*Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m*



my grep return the values correct to my array and the values in array will
be like this obviously:

*Options=-a"hello" -mt -ml3 *
*"dir1\dir2"-k -p *
*"dir3\dir4" -m*
**
**
But, what I'm interested in getting the output values are:
*"dir1\dir2"*
*"dir3\dir4"*

I do not know how to get them..can u suggest pls.?


thanks
Umesh


#!/usr/bin/perl

use strict;
use warnings;

my $line='Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m';

for ( split /\s+/, $line ){
  if( /^-i(.*)/ ){
print "$1\n";
  }
}

__END__



--

Just my 0.0002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: split regex

2005-12-15 Thread John Doe
Umesh T G am Donnerstag, 15. Dezember 2005 15.31:
> Hi Joe,
>
> just to correct my prevoius one,  my $line does not have * in the begining,
> that was a type.  the $line value is like this
>
> *Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m*
>
>
>
> my grep return the values correct to my array and the values in array will
> be like this obviously:
>
> *Options=-a"hello" -mt -ml3 *
> *"dir1\dir2"-k -p *
> *"dir3\dir4" -m*
> **
> **
> But, what I'm interested in getting the output values are:
> *"dir1\dir2"*
> *"dir3\dir4"*
>
> I do not know how to get them..can u suggest pls.?


use strict;
use warnings;

my $str=q(Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m);

# this is only one possibility. I use \s* in the case spaces are
# allowed after -i. 
# Instead of [^"]+ also .+? works.
# You could also modify the regex to allow " as well as ' around dirs.
#
my @dirs=$str=~m,-i\s*"([^"]+)",g;

print join "\n", @dirs;

# output:
dir1\dir2
dir3\dir4

ok?
:-)

[top post history following]

> On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > Umesh T G am Donnerstag, 15. Dezember 2005 14.20:
> > > Hi John,
> >
> > Hi Umesh
> >
> > > I tried like this,   where $line='*Options=-a"hello" -mt -ml3
> >
> > -i"dir1\dir2"
> >
> > > -k -p -i"dir3\dir4" -m'*
> > >
> > >
> > >
> > > if (grep/^Options/,$line)
> > > {
> > >
> > > @inc=split(/-i/,$line);
> > >
> > > foreach $word (@inc)
> > > {
> > > print "$word\n";
> > > }
> > >
> > >
> > >
> > > I do not know how to proceed after this.
> > > Thanks for your quick reply...
> >
> > You're welcome...
> >
> > try the following:
> >
> > a) put
> >   use strict;
> >   use warnings;
> > at the beginning of the script
> >
> > b) look at the warnings and then declare the vars with my, see
> > perldoc -f my
> >
> > c)
> > read the documentation
> > perldoc -f grep
> > to see why grep is not appropriate in the if clause
> >
> > d) check the documentation
> > perldoc -f perlre
> > and the others mentioned at the bottom to see why
> > /^Options/ won't ever match a string beginning with '*' and why your
> > script
> > doesn't print anything
> >
> > e) hint:
> > don't use if, only use a regex to extract the parts you like, and extract
> > them
> > directly  into an array by catching the parts you like
> >
> > ... and post the new code then :-)
> >
> > greetings joe
> >
> > > Thanks
> > > Umesh
> > >
> > > On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > > Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > > > > Hi List,
> > > >
> > > > Hi Umesh
> > > >
> > > > > I want to get that value of *-i* set in below line.
> > > > >
> > > > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4" -m*
> > > > >
> > > > > What is the best way to get the value of *-i* values into one
> > > >
> > > > array.  For
> > > >
> > > > > ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into
> > > > > one
> > > >
> > > > array.
> > > >
> > > > What possibilities did you try (show us some code), from which the
> >
> > best
> >
> > > > could be choosed, or to which a better could be added?
> > > >
> > > > joe
> > > >
> > > > --
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >  
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >  

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: split regex

2005-12-15 Thread Umesh T G
Thanks Very much John. :) it worked, but a small problem. if I have "\"
after the directory name, it does not take as new instanance.
for ex:
if my $line is*Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p
-i"dir3\dir4\" -m -n -i"\dir5\dir6" -k*
**
then, I'm getting output like this,

dir1\dir2
dir3\dir4\dir5\dir6

This is because an extra "\" is present at the end of dir4.

can you help again pls.?   thanks so much.

I want the output as

dir1\dir2
dir3\dir4
dir5\dir6



Umesh







On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
>
> Umesh T G am Donnerstag, 15. Dezember 2005 15.31:
> > Hi Joe,
> >
> > just to correct my prevoius one,  my $line does not have * in the
> begining,
> > that was a type.  the $line value is like this
> >
> > *Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m*
> >
> >
> >
> > my grep return the values correct to my array and the values in array
> will
> > be like this obviously:
> >
> > *Options=-a"hello" -mt -ml3 *
> > *"dir1\dir2"-k -p *
> > *"dir3\dir4" -m*
> > **
> > **
> > But, what I'm interested in getting the output values are:
> > *"dir1\dir2"*
> > *"dir3\dir4"*
> >
> > I do not know how to get them..can u suggest pls.?
>
>
> use strict;
> use warnings;
>
> my $str=q(Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m);
>
> # this is only one possibility. I use \s* in the case spaces are
> # allowed after -i.
> # Instead of [^"]+ also .+? works.
> # You could also modify the regex to allow " as well as ' around dirs.
> #
> my @dirs=$str=~m,-i\s*"([^"]+)",g;
>
> print join "\n", @dirs;
>
> # output:
> dir1\dir2
> dir3\dir4
>
> ok?
> :-)
>
> [top post history following]
>
> > On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > Umesh T G am Donnerstag, 15. Dezember 2005 14.20:
> > > > Hi John,
> > >
> > > Hi Umesh
> > >
> > > > I tried like this,   where $line='*Options=-a"hello" -mt -ml3
> > >
> > > -i"dir1\dir2"
> > >
> > > > -k -p -i"dir3\dir4" -m'*
> > > >
> > > >
> > > >
> > > > if (grep/^Options/,$line)
> > > > {
> > > >
> > > > @inc=split(/-i/,$line);
> > > >
> > > > foreach $word (@inc)
> > > > {
> > > > print "$word\n";
> > > > }
> > > >
> > > >
> > > >
> > > > I do not know how to proceed after this.
> > > > Thanks for your quick reply...
> > >
> > > You're welcome...
> > >
> > > try the following:
> > >
> > > a) put
> > >   use strict;
> > >   use warnings;
> > > at the beginning of the script
> > >
> > > b) look at the warnings and then declare the vars with my, see
> > > perldoc -f my
> > >
> > > c)
> > > read the documentation
> > > perldoc -f grep
> > > to see why grep is not appropriate in the if clause
> > >
> > > d) check the documentation
> > > perldoc -f perlre
> > > and the others mentioned at the bottom to see why
> > > /^Options/ won't ever match a string beginning with '*' and why your
> > > script
> > > doesn't print anything
> > >
> > > e) hint:
> > > don't use if, only use a regex to extract the parts you like, and
> extract
> > > them
> > > directly  into an array by catching the parts you like
> > >
> > > ... and post the new code then :-)
> > >
> > > greetings joe
> > >
> > > > Thanks
> > > > Umesh
> > > >
> > > > On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> > > > > Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > > > > > Hi List,
> > > > >
> > > > > Hi Umesh
> > > > >
> > > > > > I want to get that value of *-i* set in below line.
> > > > > >
> > > > > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4"
> -m*
> > > > > >
> > > > > > What is the best way to get the value of *-i* values into one
> > > > >
> > > > > array.  For
> > > > >
> > > > > > ex:  I want the output as:   *dir1\dir2*   and *dir3\dir4*  into
> > > > > > one
> > > > >
> > > > > array.
> > > > >
> > > > > What possibilities did you try (show us some code), from which the
> > >
> > > best
> > >
> > > > > could be choosed, or to which a better could be added?
> > > > >
> > > > > joe
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >  
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >  
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>


Re: split regex

2005-12-15 Thread Umesh T G
Sorry for that John. It works fine.

Many thanks for your help.


Umesh


On 12/16/05, Umesh T G <[EMAIL PROTECTED]> wrote:
>
> Thanks Very much John. :) it worked, but a small problem. if I have
> "\" after the directory name, it does not take as new instanance.
> for ex:
> if my $line is*Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p
> -i"dir3\dir4\" -m -n -i"\dir5\dir6" -k*
> **
> then, I'm getting output like this,
>
> dir1\dir2
> dir3\dir4\dir5\dir6
>
> This is because an extra "\" is present at the end of dir4.
>
> can you help again pls.?   thanks so much.
>
> I want the output as
>
> dir1\dir2
> dir3\dir4
> dir5\dir6
>
>
>
> Umesh
>
>
>
>
>
>
>
> On 12/15/05, John Doe <[EMAIL PROTECTED]> wrote:
> >
> > Umesh T G am Donnerstag, 15. Dezember 2005 15.31:
> > > Hi Joe,
> > >
> > > just to correct my prevoius one,  my $line does not have * in the
> > begining,
> > > that was a type.  the $line value is like this
> > >
> > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4" -m*
> > >
> > >
> > >
> > > my grep return the values correct to my array and the values in array
> > will
> > > be like this obviously:
> > >
> > > *Options=-a"hello" -mt -ml3 *
> > > *"dir1\dir2"-k -p *
> > > *"dir3\dir4" -m*
> > > **
> > > **
> > > But, what I'm interested in getting the output values are:
> > > *"dir1\dir2"*
> > > *"dir3\dir4"*
> > >
> > > I do not know how to get them..can u suggest pls.?
> >
> >
> > use strict;
> > use warnings;
> >
> > my $str=q(Options=-a"hello" -mt -ml3 -i"dir1\dir2"-k -p -i"dir3\dir4"
> > -m);
> >
> > # this is only one possibility. I use \s* in the case spaces are
> > # allowed after -i.
> > # Instead of [^"]+ also .+? works.
> > # You could also modify the regex to allow " as well as ' around dirs.
> > #
> > my @dirs=$str=~m,-i\s*"([^"]+)",g;
> >
> > print join "\n", @dirs;
> >
> > # output:
> > dir1\dir2
> > dir3\dir4
> >
> > ok?
> > :-)
> >
> > [top post history following]
> >
> > > On 12/15/05, John Doe < [EMAIL PROTECTED]> wrote:
> > > > Umesh T G am Donnerstag, 15. Dezember 2005 14.20:
> > > > > Hi John,
> > > >
> > > > Hi Umesh
> > > >
> > > > > I tried like this,   where $line='*Options=-a"hello" -mt -ml3
> > > >
> > > > -i"dir1\dir2"
> > > >
> > > > > -k -p -i"dir3\dir4" -m'*
> > > > >
> > > > >
> > > > >
> > > > > if (grep/^Options/,$line)
> > > > > {
> > > > >
> > > > > @inc=split(/-i/,$line);
> > > > >
> > > > > foreach $word (@inc)
> > > > > {
> > > > > print "$word\n";
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > I do not know how to proceed after this.
> > > > > Thanks for your quick reply...
> > > >
> > > > You're welcome...
> > > >
> > > > try the following:
> > > >
> > > > a) put
> > > >   use strict;
> > > >   use warnings;
> > > > at the beginning of the script
> > > >
> > > > b) look at the warnings and then declare the vars with my, see
> > > > perldoc -f my
> > > >
> > > > c)
> > > > read the documentation
> > > > perldoc -f grep
> > > > to see why grep is not appropriate in the if clause
> > > >
> > > > d) check the documentation
> > > > perldoc -f perlre
> > > > and the others mentioned at the bottom to see why
> > > > /^Options/ won't ever match a string beginning with '*' and why your
> >
> > > > script
> > > > doesn't print anything
> > > >
> > > > e) hint:
> > > > don't use if, only use a regex to extract the parts you like, and
> > extract
> > > > them
> > > > directly  into an array by catching the parts you like
> > > >
> > > > ... and post the new code then :-)
> > > >
> > > > greetings joe
> > > >
> > > > > Thanks
> > > > > Umesh
> > > > >
> > > > > On 12/15/05, John Doe < [EMAIL PROTECTED]> wrote:
> > > > > > Umesh T G am Donnerstag, 15. Dezember 2005 13.00:
> > > > > > > Hi List,
> > > > > >
> > > > > > Hi Umesh
> > > > > >
> > > > > > > I want to get that value of *-i* set in below line.
> > > > > > >
> > > > > > > *Options=-a"hello" -mt -ml3 -i"dir1\dir2" -k -p -i"dir3\dir4"
> > -m*
> > > > > > >
> > > > > > > What is the best way to get the value of *-i* values into one
> > > > > >
> > > > > > array.  For
> > > > > >
> > > > > > > ex:  I want the output as:   *dir1\dir2*   and
> > *dir3\dir4*  into
> > > > > > > one
> > > > > >
> > > > > > array.
> > > > > >
> > > > > > What possibilities did you try (show us some code), from which
> > the
> > > >
> > > > best
> > > >
> > > > > > could be choosed, or to which a better could be added?
> > > > > >
> > > > > > joe
> > > > > >
> > > > > > --
> > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > < http://learn.perl.org/> 
> > > >
> > > > --
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > < http://learn.perl.org/> 
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >  < http