Recently I downloaded some badly formated SRT files, having the time format messed up as
HH:MM:SS:XXX
whereas it should be
HH:MM:SS,XXX
The main problem now is to replace the third colon with a comma in every timing line formatted as
HH:MM:SS,XXX --> HH:MM:SS,XX
Can anyone suggest a sed/awk script to fix this problem in the entire file? I did try
sed 's/:/,/3;s/:/,/5' file
but it didn't seem to work
Edit: Answered my own question, having forgotten all about backreferences
sed -E "s/([0-9][0-9])(:)([0-9][0-9][0-9])/\1,\3/g"