[FFmpeg-user] Extract chapter names to a text file?
Dan Harkless
ffmpeg at harkless.org
Tue Dec 6 02:41:24 EET 2022
On 12/5/2022 4:30 PM, Carl Zwanzig wrote:
> On 12/5/2022 4:20 PM, Laine wrote:
> >
> > And the following appears to remove “title=“ from lines generated by "grep '^title=‘ chapters.txt” alone.
> >
> > grep '^title=' chapters.txt | perl -pe 's/title=//s’
>
> I'm not clear you you'd use perl at all when sed is more common for this
> sort of thing (sed 's/title=//’), but whatever works for you.
If it were me, I'd also add a '^' to anchor the regular expression
(regexp) to the beginning of the line, as in 's/^title=//', just on the
off chance the string "title=" appears in a chapter name. That'll work
in sed or perl.
And in the perl regexp, the 's' at the end isn't needed there (only
changes how the '.' character is processed). And if you copy and paste
from the above, note that those curly quotes should be straight quotes.
Putting that all together:
grep '^title=' chapters.txt | perl -pe 's/^title=//'
or:
grep '^title=' chapters.txt | sed 's/^title=//'
--
Dan Harkless
http://harkless.org/dan/
More information about the ffmpeg-user
mailing list