Search This Blog

Monday, July 16, 2018

Vim Command to delete all the lines that begins with a digit.

[Command]
:g/^\d.*$/d

[Options]
g - global command
^ - start of line
\d - match digit
. - match any character after \d
* - 0 or more occurence of .
$ - end of line
/d - delete

[Example]
(I used it to delete following subtitle meta data to retain only text)
1337
00:00:00,000 --> 00:00:20,020