我有一个像这样的 URL 列表
http://www.blabla.com/1/1.jpg
http://www.blabla.com/1/2.jpg
http://www.blabla.com/1/3.jpg
...
http://www.blabla.com/2/1.jpg
http://www.blabla.com/2/2.jpg
http://www.blabla.com/2/3.jpg
...
所以我需要复制http://www.blabla.com/X/
并添加数字,例如:
http://www.blabla.com/1/1.jpg
http://www.blabla.com/1/2.jpg
http://www.blabla.com/1/3.jpg
http://www.blabla.com/1/4.jpg
http://www.blabla.com/1/5.jpg
...
http://www.blabla.com/2/1.jpg
http://www.blabla.com/2/2.jpg
http://www.blabla.com/2/3.jpg
http://www.blabla.com/2/4.jpg
http://www.blabla.com/2/5.jpg
...
直到20.jpg
或更高。我想我可以改变它。
这可能吗?
嘿,谢谢,但效果不如我所愿,这是我自己的错,因为我将列表更改为最小值,因为我以为我可以自己调整脚本。所以在这里我再次尝试更好地解释它:
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/saaosao-laowia-pqoaian-11.jpg = block 1
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-12.jpg = block 1
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-13.jpg = block 1
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-11.jpg = block 2
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-12.jpg = block 2
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-13.jpg = block 2 ....
http://www.blabla.com/abc/uploads/pics/< 那句话总是相同的
alkalqoa%makawoa%wkwiaux < 在每个块中都是相同的,名称和 ''%'' 的数量根据名称而不同
saosao-laowia-pqoaian-11.jpg < 除了 .jpg 前面的数字外,每个块都相同,''-'' 的数量根据名称而不同
反斜杠的编号始终相同(7)
区块 1,2.. 只是为了更好地演示的一个例子,与我的列表无关
结果应该是这样的:
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/saaosao-laowia-pqoaian-11.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-12.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-13.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-14.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-15.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-16.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-17.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-18.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-19.jpg
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-110.jpg < ''20'' begins with 110
http://www.blabla.com/abc/uploads/pics/alkalqoa%makawoa%wkwiaux/ssaosao-laowia-pqoaian-111.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-11.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-12.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-13.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-14.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-15.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-16.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-17.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-18.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-19.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-110.jpg
http://www.blabla.com/abc/uploads/pics/kdkdaap%oqunxla%dkjdujauw%ipajqw/bazwow-axkaww-poqianxh-iapaxja-111.jpg
此列表中还有一些以 21.jpg 结尾的行
这里的编号是
21 22 23 24 25 26 27 28 29 210 < ''30'' begins with 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
每个块的总行数应为 24。
所以,我希望这能更好地解释一切。
答案1
这很简单Python脚本已安装 Notepad++ 插件(可以从插件管理器安装)。只需使用以下代码创建一个新脚本:
for x in range(1, 21):
for y in range(1, 21):
editor.addText(str.format("http://www.blabla.com/{0}/{1}.jpg\r\n", x, y))
editor.addText("\r\n")
在新文档中运行脚本。
答案2
解决方案
$content = gc 'c:\liste.txt'
$liste_neu = 'c:\liste_neu.txt'
foreach($line in $content){
$num = [regex]::match($line,'(\d+)\.jpg$').Groups[1].Value
switch($num){
"11" {
11..19 | %{$line -replace '\d+\.jpg$',"$($_).jpg"} | add-content -path $liste_neu
110..124 | %{$line -replace '\d+\.jpg$',"$($_).jpg"} | add-content -path $liste_neu
}
"21" {
21..29 | %{$line -replace '\d+\.jpg$',"$($_).jpg"} | add-content -path $liste_neu
210..224 | %{$line -replace '\d+\.jpg$',"$($_).jpg"} | add-content -path $liste_neu
}
"1" {
1..24 | %{$line -replace '\d+\.jpg$',"$($_).jpg"} | add-content -path $liste_neu
}
}}