新增重複的行和數字

新增重複的行和數字

我有一個 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)

Block 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
        }
}}

相關內容