Created
May 8, 2020 19:02
-
-
Save mrdwab/633979f2d0d61b9619fa645d8cff121b to your computer and use it in GitHub Desktop.
This file contains 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
x <- readLines("~/Downloads/Andy - Career Talk/exported.srt") | |
cat(x[1:10], sep = "\n") | |
## 1 | |
## 00:00:00,640 --> 00:00:12,850 | |
## [Music] | |
## | |
## 2 | |
## 00:00:12,850 --> 00:00:19,910 | |
## Hi, my name is Andy Liepman, and Partners | |
## | |
## 3 | |
## 00:00:19,910 --> 00:00:23,900 | |
## NULL | |
## Which lines need to be fixed | |
y <- x[seq(from = 6, to = length(x), by = 4)] | |
## Increment the first number after the comma by 1 | |
substring(y, 10, 12) <- sprintf("%03d", as.numeric(substr(y, 10, 12))+1) | |
## Replace the old timecode with the new one | |
x[seq(from = 6, to = length(x), by = 4)] <- z | |
## But what about "00:00:19,999" ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment