Your skill will accomplish what the force of many cannot |
|
PerlMonks |
One liner with globs on Windows to parse .srt filesby LanX (Saint) |
on May 14, 2021 at 11:09 UTC ( [id://11132576]=perlquestion: print w/replies, xml ) | Need Help?? |
LanX has asked for the wisdom of the Perl Monks concerning the following question:
Hi Yesterday I needed a Perl one-liner ( -e ) to loop over ( -n ) several subtitle files glob*.srt to find those which are in sync with the video I had. Hence I needed paragraph mode ( -00 ) to see the timestamps
trouble is cmd.exe doesn't do *glob expansion, and my git-bash didn't like the paragraph mode, most probably because of different understandings of line endings I ended up with something like this perl -00nE"BEGIN{@ARGV=<@ARGV>}say qq{=== $ARGV ===\n$_} if /ditto/i" *Filenames* but the BEGIN block is a bit ugly. Any more elegant way to do this? One generic workaround could be a special module wglob to do the BEGIN part with perl -Mwglob but I'd like to ask the community first...
Cheers Rolf
Back to
Seekers of Perl Wisdom
|
|