I would like to parse Artist and title of song from m3u playlist with batch command
#EXTM3U
#EXTINF:151,TJR - We Wanna Party Into We Want Some Pussy (BB Tribe EDIT)
\#Mixit\pjesme\TJR - We Wanna Party Into We Want Some Pussy (BeatBreaker Tribe EDIT).mp3
#EXTINF:202,Alan Walker - Alone (Prisoners Bootleg)
\Users\Asrock 880\Downloads\Alan Walker - Alone (Prisoners Bootleg).mp3
#EXTINF:236,Alan Walker - Alone 2k17 (#Ash Simons Bangerz) (Ft. Holl & Rush)
so the output .txt file will look like this
TJR - We Wanna Party Into We Want Some Pussy (BB Tribe EDIT)
Alan Walker - Alone (Prisoners Bootleg)
Alan Walker - Alone 2k17 (#Ash Simons Bangerz) (Ft. Holl & Rush)
Any help will be useful, thanks
It can be power shell too or anything other but with a better description I'm DJ... :P
#EXTINF
following the comma.findstr
to select lines with a pattern (see findstr /?)for /f
to parse the content of a line with delimiters and tokens (see for /?)In a batch:
@Echo off
(For %%M in (*.m3u
) Do For /f "tokens=1* delims=," "%%A" in (
'findstr "^#EXTINF" %%M'
) Do Echo %%B
) > Playlists.txt
On the cmd line:
@For /f "tokens=1* delims=," %A in ('findstr "^#EXTINF" playlist.m3u') Do @Echo %B
To redirect to a file enclose the for command in parentheses and append >playlist.txt