Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tricky little s///

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
US
You guys are gonna kill me.

Now that I got my script searching for something simple, I want to search for this:
<$@App.ShareDirectory>\Images\Shirley

And replace it with:
\\Dell2400\IMAGES\Brian\217531\000001\001.jpg
 
$this = &quot;<$@App.ShareDirectory>\Images\Shirley\&quot;;
$that = &quot;\\Dell2400\IMAGES\Brian\217531\000001\001.jpg&quot;;

$text =~ s/\E$this\Q/$that/go;


Untested, but should work. Kill you? Nah. We would just stop visiting this web site if we were that frustrated. (I hope)

--Jim
 
Actually got it to work like this:
foreach $temp(@file_data){
if($temp =~ s/Layout/Job/){print &quot;It changed $temp&quot;;}
$tempVar1 = index($temp, &quot;<&quot;);
$tempVar2 = index($temp, &quot;>&quot;);
if($tempVar1 > -1){
$tempOff = ($tempVar2 + 1) - $tempVar1;
substr($temp,$tempVar1,$tempOff,&quot;&quot;);
}
if($temp =~ s/\\Images\\Shirley/$newPath/){print &quot;It changed $temp&quot;;}
print JOB &quot;$temp&quot;;
}

First I strip out the <...> stuff then I can search for the \Images\Shirley stuff. Thanks guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top