Skip to content

Instantly share code, notes, and snippets.

@jmgz4e9
Created April 7, 2018 08:34
Show Gist options
  • Save jmgz4e9/ab8139728a83103878aac71768959907 to your computer and use it in GitHub Desktop.
Save jmgz4e9/ab8139728a83103878aac71768959907 to your computer and use it in GitHub Desktop.
strip HI from srt
<foo.srt tr '[]' '{}'\
| dos2unix
| awk -f srt-strip-HI.awk
| tr '{}' '[]'
/^[0-9]+/ { body = body "\n" $0; next }
/^<[^>]+>\r?$/ { body = ""; next }
/^[:space:]*$/ { next }
1 { print body; print $0; body = "" }
BEGIN { ctr = 0 }
/^[0-9]+$/ { next }
/^[0-9][0-9]:/ { line2 = $0; next }
/^\{[^\}]+\}\r?$/ { next }
/^[:space:]*$/ { next }
1 { print ""; print ++ctr; print line2; print $0; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment