Re: formatting a string

2007-07-03 Thread Tom Phoenix

On 7/3/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:


I always deal with indices' 1 through to the end in the function in question,
so it's easy to get the second indices (First disc) and so on.


Huh?


I need to manipulate the path though now, I am wanting to search
for *all* the text following the third "/" and before the fourth "/" and
replace it with a string variable.


That sounds almost as if you're wanting to use substr and index: index
to locate each "/", and substr to work with the identified part of the
string.

Or maybe you want to use a substitution (s///), but I doubt that.

But if you're really manipulating file and directory names, probably a
solution involving (say) File::Basename or another module would be
more likely to be correct.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: formatting a string

2007-07-03 Thread Prabu Ayyappan
A quick solutionMay be you can enhance it more as you like..
   
  @discarr = ('/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 
Ent x64)/AN-DC (Win2003 Ent 
x64).vmx','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent 
x64)/Disc 1.vmdk','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC 
(Win2003 Ent  x64)/Disc 2.vmdk');
  $replace = "REPLACESTRING";
  foreach $disc(@discarr){
  print "Before $disc \n";
  $disc =~ s/\/vmfs\/volumes\/(.*?)\//\/vmfs\/volumes\/$replace\//gi;
  print "After $disc \n";
}
   
  Hope this helps.
   
  Thanks,
  Prabu.M.A
"Joseph L. Casale" <[EMAIL PROTECTED]> wrote:
  I have an array with the following data in it:

/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC 
(Win2003 Ent x64).vmx
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
1.vmdk
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
2.vmdk

I always deal with indices' 1 through to the end in the function in question, 
so it's easy to get the second indices (First disc) and so on. I need to 
manipulate the path though now, I am wanting to search for *all* the text 
following the third "/" and before the fourth "/" and replace it with a string 
variable. So far, this is seeming to be way over my current capacity :)

Can anyone point me to the topic/method I should use so I may read up on build 
this myself?

Thanks!
jlc




 
-
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.

RE: formatting a string

2007-07-03 Thread Joseph L. Casale
Yup, lol...
Wish I understood this! What is the line that does the search called? What do I 
look up to read up on this?
Thanks!
jlc

From: Prabu Ayyappan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 03, 2007 10:55 PM
To: Joseph L. Casale; beginners@perl.org
Subject: Re: formatting a string

A quick solutionMay be you can enhance it more as you like..

@discarr = ('/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 
Ent x64)/AN-DC (Win2003 Ent 
x64).vmx','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent 
x64)/Disc 1.vmdk','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC 
(Win2003 Ent  x64)/Disc 2.vmdk');
$replace = "REPLACESTRING";
foreach $disc(@discarr){
  print "Before $disc \n";
  $disc =~ s/\/vmfs\/volumes\/(.*?)\//\/vmfs\/volumes\/$replace\//gi;
  print "After $disc \n";
}

Hope this helps.

Thanks,
Prabu.M.A
"Joseph L. Casale" <[EMAIL PROTECTED]> wrote:
I have an array with the following data in it:

/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC 
(Win2003 Ent x64).vmx
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
1.vmdk
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
2.vmdk

I always deal with indices' 1 through to the end in the function in question, 
so it's easy to get the second indices (First disc) and so on. I need to 
manipulate the path though now, I am wanting to search for *all* the text 
following the third "/" and before the fourth "/" and replace it with a string 
variable. So far, this is seeming to be way over my current capacity :)

Can anyone point me to the topic/method I should use so I may read up on build 
this myself?

Thanks!
jlc






The fish are biting.
Get more 
visitors<http://us.rd.yahoo.com/evt=49679/*http:/searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50>
 on your site using Yahoo! Search 
Marketing.<%0d%0ahttp:/us.rd.yahoo.com/evt=49679/*http:/searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50>




RE: formatting a string

2007-07-03 Thread Prabu Ayyappan
Read Perl reqular expression and search replace.
   
  $perldoc perlretut
   
  http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlretut.pod

"Joseph L. Casale" <[EMAIL PROTECTED]> wrote:
v\:* {behavior:url(#default#VML);}  o\:* {behavior:url(#default#VML);}  
w\:* {behavior:url(#default#VML);}  .shape {behavior:url(#default#VML);}
Yup, lolÂ…
Wish I understood this! What is the line that does the search called? What do I 
look up to read up on this?
  Thanks!
jlc
   
From: Prabu Ayyappan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 03, 2007 10:55 PM
To: Joseph L. Casale; beginners@perl.org
Subject: Re: formatting a string

   
A quick solutionMay be you can enhance it more as you like..

 

@discarr = ('/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC 
(Win2003 Ent x64)/AN-DC (Win2003 Ent 
x64).vmx','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent 
x64)/Disc 1.vmdk','/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC 
(Win2003 Ent  x64)/Disc 2.vmdk');

$replace = "REPLACESTRING";

foreach $disc(@discarr){
  print "Before $disc \n";
  $disc =~ s/\/vmfs\/volumes\/(.*?)\//\/vmfs\/volumes\/$replace\//gi;
  print "After $disc \n";
}

 

Hope this helps.

 

Thanks,

Prabu.M.A
"Joseph L. Casale" <[EMAIL PROTECTED]> wrote:

I have an array with the following data in it:

/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC 
(Win2003 Ent x64).vmx
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
1.vmdk
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
2.vmdk

I always deal with indices' 1 through to the end in the function in question, 
so it's easy to get the second indices (First disc) and so on. I need to 
manipulate the path though now, I am wanting to search for *all* the text 
following the third "/" and before the fourth "/" and replace it with a string 
variable. So far, this is seeming to be way over my current capacity :)

Can anyone point me to the topic/method I should use so I may read up on build 
this myself?

Thanks!
jlc


   


-
  
  The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing. 



   
-
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. 

Re: formatting a string

2007-07-04 Thread Mumia W.

On 07/03/2007 08:32 PM, Joseph L. Casale wrote:

I have an array with the following data in it:

/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC 
(Win2003 Ent x64).vmx
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
1.vmdk
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
2.vmdk

I always deal with indices' 1 through to the end in the function in question, so it's easy to get 
the second indices (First disc) and so on. I need to manipulate the path though now, I am wanting 
to search for *all* the text following the third "/" and before the fourth "/" 
and replace it with a string variable. So far, this is seeming to be way over my current capacity :)

Can anyone point me to the topic/method I should use so I may read up on build 
this myself?

Thanks!
jlc





File::Spec->splitdir will let you split the string into directories 
which you can manipulate individually.


Or you can just use the split function to split on "/".

Good luck.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/