I have a text file, which has an inconsistent timestamp format, that I would like to standardize. This is in a transcript from an interview; ultimately for textual analysis.
What command could I run 3x for each set of lines, through Linux terminal?
(1st) 00:0 before each line 1 thru 128 e.g. 0:32.6 becomes 00:00:32.6
(2nd) 00: before each line 129 thru 713 e.g. 10:02.6 becomes 00:10:02.6
(3rd) 0 before each line 714 thru 2285 e.g. 1:00:07.0 becomes 01:00:07.0
I'm aware I could split the file into 3, and add a different prefix to all of the lines of each file; but I need to execute numerous commands on the file, and constantly spliting and merging files would waste time.
The following articles:
https://baeldung.com/linux/file-insert-prefix-every-line
I want to edit a specific lines (multiple) with sed command
Either handle only specific lines, or all lines; and I want to edit a specific series of lines
The best I could come up with:
$ sed "$(print -f '%ds/./00:0&/g;' 1 [thru] 128)" filename
But I don't know how the [thru] functionality would be included.