Alexander_88
23-10-2018, 06:51
Здравствуйте. Есть большой txt файл. В нём список сообщений с разделителем (в конце каждого сообщения). Необходимо разделить данный txt файл на несколько других txt файлов. В базовом txt файле, много сообщений с ссылками на различные имена файлов. Нужно разделить этот txt файл по маске (которую я укажу) имени файла ссылки :). То есть в результате у нас получится множество txt файлов, в каждом из которых будут сообщения с ссылками, где имена файлов будут совпадать с указанной маской.
Пример:
базовый txt файл:
Subject message
http://s5.depic.me/0686/zp0hjgh3m7d_o/0634yandex_m.jpg
http://s6.depic.me/06876/26fhgh8kxo8_o/0634yandex_t.jpg
File Name.type: 0634yandex.avi
Resolution: 1920x1080
Duration: 0:08:56
Filesize: 952Mb
Download
https://k2s.cc/file/f07we76wee3/0634yandex.mp4
//==================
Subject message
http://s7.depic.me/065676/cjb9jhkjhbm78_o/0087start_m.jpg
http://s7.depic.me/07666/56ygjfjh7kikg_o/0087start_t.jpg
File Name.type: 0087start.wmv
Resolution: 640x480
Duration: 0:53:20
Filesize: 311Mb
Download
https://k2s.cc/file/059we76456/0087start.mp4
//==================
Subject message
http://s5.depic.me/06396/xj0hgkoio_o/0248google_m.jpg
http://s5.depic.me/67556/w12jhgjblxh_o/0248google_t.jpg
File Name.type: 0248google.mp4
Resolution: 1280x720
Duration: 0:05:44
Filesize: 169Mb
Download
https://k2s.cc/file/8c76web35b/0248google.mp4
//==================
Subject message
http://s6.depic.me/07396/uzpqptzh8rxl_o/0007start_m.jpg
http://s7.depic.me/07156/puojhjh95tn_o/0007start_t.jpg
File Name.type: 0007start.mp4
Resolution: 1280x720
Duration: 0:05:35
Filesize: 59Mb
Download
https://k2s.cc/file/28s76ds8d82/0007start.mp4
//==================
Примечание: Домены в ссылках могут быть разными.
К скрипте я указываю путь/имя создаваемых файлов, а также маску имени файла в ссылке:
firstpackuurl.txt
*start*
secondpackurl.txt
*yandex*
В результате выполнения скрипта, должны создаться два txt файла:
firstpackuurl.txt
Subject message
http://s7.depic.me/065676/cjb9jhkjhbm78_o/0087start_m.jpg
http://s7.depic.me/07666/56ygjfjh7kikg_o/0087start_t.jpg
File Name.type: 0087start.wmv
Resolution: 640x480
Duration: 0:53:20
Filesize: 311Mb
Download
https://k2s.cc/file/059we76456/0087start.mp4
//==================
Subject message
http://s6.depic.me/07396/uzpqptzh8rxl_o/0007start_m.jpg
http://s7.depic.me/07156/puojhjh95tn_o/0007start_t.jpg
File Name.type: 0007start.mp4
Resolution: 1280x720
Duration: 0:05:35
Filesize: 59Mb
Download
https://k2s.cc/file/28s76ds8d82/0007start.mp4
//==================
secondpackurl.txt
Subject message
http://s5.depic.me/0686/zp0hjgh3m7d_o/0634yandex_m.jpg
http://s6.depic.me/06876/26fhgh8kxo8_o/0634yandex_t.jpg
File Name.type: 0634yandex.avi
Resolution: 1920x1080
Duration: 0:08:56
Filesize: 952Mb
Download
https://k2s.cc/file/f07we76wee3/0634yandex.mp4
//==================
Пример:
базовый txt файл:
Subject message
http://s5.depic.me/0686/zp0hjgh3m7d_o/0634yandex_m.jpg
http://s6.depic.me/06876/26fhgh8kxo8_o/0634yandex_t.jpg
File Name.type: 0634yandex.avi
Resolution: 1920x1080
Duration: 0:08:56
Filesize: 952Mb
Download
https://k2s.cc/file/f07we76wee3/0634yandex.mp4
//==================
Subject message
http://s7.depic.me/065676/cjb9jhkjhbm78_o/0087start_m.jpg
http://s7.depic.me/07666/56ygjfjh7kikg_o/0087start_t.jpg
File Name.type: 0087start.wmv
Resolution: 640x480
Duration: 0:53:20
Filesize: 311Mb
Download
https://k2s.cc/file/059we76456/0087start.mp4
//==================
Subject message
http://s5.depic.me/06396/xj0hgkoio_o/0248google_m.jpg
http://s5.depic.me/67556/w12jhgjblxh_o/0248google_t.jpg
File Name.type: 0248google.mp4
Resolution: 1280x720
Duration: 0:05:44
Filesize: 169Mb
Download
https://k2s.cc/file/8c76web35b/0248google.mp4
//==================
Subject message
http://s6.depic.me/07396/uzpqptzh8rxl_o/0007start_m.jpg
http://s7.depic.me/07156/puojhjh95tn_o/0007start_t.jpg
File Name.type: 0007start.mp4
Resolution: 1280x720
Duration: 0:05:35
Filesize: 59Mb
Download
https://k2s.cc/file/28s76ds8d82/0007start.mp4
//==================
Примечание: Домены в ссылках могут быть разными.
К скрипте я указываю путь/имя создаваемых файлов, а также маску имени файла в ссылке:
firstpackuurl.txt
*start*
secondpackurl.txt
*yandex*
В результате выполнения скрипта, должны создаться два txt файла:
firstpackuurl.txt
Subject message
http://s7.depic.me/065676/cjb9jhkjhbm78_o/0087start_m.jpg
http://s7.depic.me/07666/56ygjfjh7kikg_o/0087start_t.jpg
File Name.type: 0087start.wmv
Resolution: 640x480
Duration: 0:53:20
Filesize: 311Mb
Download
https://k2s.cc/file/059we76456/0087start.mp4
//==================
Subject message
http://s6.depic.me/07396/uzpqptzh8rxl_o/0007start_m.jpg
http://s7.depic.me/07156/puojhjh95tn_o/0007start_t.jpg
File Name.type: 0007start.mp4
Resolution: 1280x720
Duration: 0:05:35
Filesize: 59Mb
Download
https://k2s.cc/file/28s76ds8d82/0007start.mp4
//==================
secondpackurl.txt
Subject message
http://s5.depic.me/0686/zp0hjgh3m7d_o/0634yandex_m.jpg
http://s6.depic.me/06876/26fhgh8kxo8_o/0634yandex_t.jpg
File Name.type: 0634yandex.avi
Resolution: 1920x1080
Duration: 0:08:56
Filesize: 952Mb
Download
https://k2s.cc/file/f07we76wee3/0634yandex.mp4
//==================