-
Ctrl + H
- Encontre o que:
\d+
- Substituir por:
$id = "$0"\n$w = Get-SPWeb $urlWeb\n$l = $w.Lists[$listName]\n$i = $l.GetItemById\($id\)\n
- check Embrulhe
- verificar expressão regular
- Substituir todos
Explicação:
\d+ : 1 or more digits
Substituição:
$0 means whole match, ie. the number
$id = "$0" : first line
\n : line break, you could use \r\n
$w = Get-SPWeb $urlWeb : second line
\n : line break, you could use \r\n
$l = $w.Lists[$listName] : third line
\n : line break, you could use \r\n
$i = $l.GetItemById\($id\) : fourth line, parenthesis have to be escaped in Npp
\n : line break, you could use \r\n
Resultado para o exemplo dado:
$id = "1234"
$w = Get-SPWeb $urlWeb
$l = $w.Lists[$listName]
$i = $l.GetItemById($id)
$id = "2345"
$w = Get-SPWeb $urlWeb
$l = $w.Lists[$listName]
$i = $l.GetItemById($id)
$id = "3456"
$w = Get-SPWeb $urlWeb
$l = $w.Lists[$listName]
$i = $l.GetItemById($id)
$id = "4567"
$w = Get-SPWeb $urlWeb
$l = $w.Lists[$listName]
$i = $l.GetItemById($id)