Reputation: 3
maybe someone can help me... I have a list (containing also cyrillic letters) like this (channels.txt):
#EXTINF:-1,5 канал Россия
http://95.189.57.162:1234/udp/233.7.70.6:5000
#EXTINF:-0,ТВ3
http://95.189.57.161:1234/udp/233.7.70.7:5000
#EXTINF:-1,ТНТ
rtmp://95.189.54.166:1234/udp/233.7.70.8:5000
#EXTINF:-2,Disney Channel
mms://95.189.52.146:1234/udp/233.7.70.9:5000
#EXTINF:-1,49 Канал
http://95.189.51.163:1234/udp/233.7.70.11:5000
The line begining with #EXTINF: gives the name of a TV channel. Channels are:
The next line is the link to that channel.
Which command or batch script could create a txt file for each channel of the list and put inside the corresponding link? For this example:
http://95.189.57.162:1234/udp/233.7.70.6:5000
http://95.189.57.161:1234/udp/233.7.70.7:5000
rtmp://95.189.54.166:1234/udp/233.7.70.8:5000
mms://95.189.52.146:1234/udp/233.7.70.9:5000
http://95.189.51.163:1234/udp/233.7.70.11:5000
I would really appreciate any help! Many thanks!
Upvotes: 0
Views: 953
Reputation: 37569
try this:
@ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION
FOR /f "tokens=2 delims=:" %%a IN ('chcp') DO SET /a CurrentCodePage=%%a 2>nul
CHCP 1251 >nul
FOR /f "tokens=1*delims=," %%a IN ('type file.txt') DO (
SET "link=%%a"
SET "channel=%%b"
IF DEFINED channel (SET "fname=!channel!"
) ELSE (ECHO !link!)>"!fname!.txt"
)
CHCP %currentCodePage% >nul
dir
output is with code page 850:
06/29/2013 08:38 AM 48 49 ?????.txt 06/29/2013 08:38 AM 47 5 ????? ??????.txt 06/29/2013 08:38 AM 46 Disney Channel.txt 06/29/2013 08:38 AM 47 ??3.txt 06/29/2013 08:38 AM 47 ???.txt
dir
output is with code page 1251:
06/29/2013 08:38 AM 48 49 Канал.txt 06/29/2013 08:38 AM 47 5 канал Россия.txt 06/29/2013 08:38 AM 46 Disney Channel.txt 06/29/2013 08:38 AM 47 ТВ3.txt 06/29/2013 08:38 AM 47 ТНТ.txt
For more information about cmd and code pages click here.
Upvotes: 4