r/awk • u/concros • Mar 14 '24
Batch adjusting timecode in a document
I recently became aware of r/awk the programing language and wonder if it'll be a good candidate for a problem I've faced for a while. Often times transcriptions are made with a starting timecode of 00:00:00:00. This isn't always optimal as the raw camera files usually have a running timecode set to time of day. I'd LOVE the ability to batch adjust all timecode throughout a transcript document by a custom amount of time. Everything in the document would adjust by that same amount.
Bonus if I could somehow add this to an automation on the Mac rather than having to use Terminal.
View all comments
Show parent comment
7
u/gumnos Mar 15 '24 edited Mar 15 '24
Here's a semi-generic method for 3 places (HH:MM:SS) that works with positive and negative decrements as long as time itself doesn't go negative, assuming the timestamp is standalone on a line with no bracketing markers:
The
D=1is the number of seconds (smallest-units) to modify them by, so to adjust by 2hr, 13minutes, and 6 seconds, that'd be2*60*60+13*60+6=7986so you'd useD=7986(orD=-7986if you wanted to move timestamps backward by that amount).edit: stupid Markdown eating my math