user217648
user217648

Reputation: 3466

parsing string using powershell

I am moving aspx files from an old system to the new one using Powershell. I need to parse the page and change href of hyperlink tags as following.

old system
href=/ranet/templates/page____9372.aspx

will be in new system

/newfolder/folder1/9372.aspx

Upvotes: 0

Views: 3706

Answers (1)

RichGK
RichGK

Reputation: 560

Try this

$input = "href=/ranet/templates/page____9372.aspx"
$new = "/newfolder/folder1/"
$array = $input.Split('_')
$array2 = ($array[$array.Count-1]).Split('.')
$newLine = $new+$array2[0]+".aspx"
$input
$newLine

Actually this is not such a great answer as you have to ensure that there are no other underline characters in the page!

Upvotes: 2

Related Questions