LanX has asked for the wisdom of the Perl Monks concerning the following question:
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
=== FILENAME.srt === 672 00:35:09,358 --> 00:35:11,027 Ditto ...
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
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: One liner with globs on Windows to parse .srt files
by haukex (Archbishop) on May 14, 2021 at 11:11 UTC | |
by LanX (Saint) on May 14, 2021 at 11:18 UTC | |
by haukex (Archbishop) on May 14, 2021 at 11:28 UTC | |
by LanX (Saint) on May 14, 2021 at 11:42 UTC | |
by haukex (Archbishop) on May 14, 2021 at 11:53 UTC | |
| |
Re: One liner with globs on Windows to parse .srt files
by Discipulus (Canon) on May 14, 2021 at 14:15 UTC | |
by LanX (Saint) on May 14, 2021 at 14:57 UTC |