Last active
January 8, 2022 00:14
-
-
Save Bigous/b557866869b4eb562f11ca11f48443be to your computer and use it in GitHub Desktop.
PowerShell to filter m3u HD tv only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Select-String .\file.m3u -Context 0,1 -Pattern "^(#EXTINF:.*\bHD$)|(#EXTM3U)|(#EXT-X-SESSION-DATA)" | | |
foreach { | |
$_.Line | |
if($_.Line -match "^#EXTINF:.*\bHD$") { $_.Context.PostContext[0] } | |
} > .\file_hd.m3u |
Second implementation:
Select-String .\file.m3u -Context 0,1 -Pattern "^(#EXTINF:.*\bHD$)|(#EXTM3U)|(#EXT-X-SESSION-DATA)" |
foreach {
$_.Line
if($_.Line -match "^#EXTINF:.*\bHD$") { $_.Context.PostContext[0] }
} > .\file_hd.m3u
It takes ~480 ms on a file with ~200000 lines
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First Implementation:
It takes ~3200 ms on a file with ~200000 lines