Sample Header Ad - 728x90

How to change \n to space and \n\n to \n by sed?

1 vote
2 answers
179 views
I use sed to convert an srt file to a regular text file. An srt` file has a format of 1 00:20:41,150 --> 00:20:45,109 line 1 line 2 2 00:21:41,150 --> 00:21:45,109 line 3 line 4 So I use the following command to remove non-text lines sed -r '/^[0-9]+$/{N;d}' file.srt > file.txt which produces line1 line2 line3 line4 but I want to get line1 line2 line3 line4 (each subtitle segment as a single line) How can I do that?
Asked by Googlebot (2009 rep)
Jan 24, 2020, 12:45 PM
Last activity: Jan 24, 2020, 01:38 PM