0

I have below string(Captured by Drone GPS).

1
00:00:00,000 --> 00:00:00,033
<font size="36">FrameCnt : 1, DiffTime : 33ms
2022-10-08 10:39:34,664,324
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.510010] </font>

2
00:00:00,033 --> 00:00:00,066
<font size="36">FrameCnt : 2, DiffTime : 33ms
2022-10-08 10:39:34,697,694
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.510010] </font>

3
00:00:00,066 --> 00:00:00,100
<font size="36">FrameCnt : 3, DiffTime : 34ms
2022-10-08 10:39:34,731,055
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.510010] </font>

4
00:00:00,100 --> 00:00:00,133
<font size="36">FrameCnt : 4, DiffTime : 33ms
2022-10-08 10:39:34,764,424
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.537994] </font>

5
00:00:00,133 --> 00:00:00,166
<font size="36">FrameCnt : 5, DiffTime : 33ms
2022-10-08 10:39:34,797,792
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.537994] </font>

I want to delete all lines containing "Date and Time" I want output as per below.

1
00:00:00,000 --> 00:00:00,033
<font size="36">FrameCnt : 1, DiffTime : 33ms
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.510010] </font>

2
00:00:00,033 --> 00:00:00,066
<font size="36">FrameCnt : 2, DiffTime : 33ms
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.510010] </font>

3
00:00:00,066 --> 00:00:00,100
<font size="36">FrameCnt : 3, DiffTime : 34ms
[iso : 100] [shutter : 1/1000.0] [fnum : 280] [ev : -0.7] [ct : 4878] [color_md : default] [focal_len : 280] [latitude : 25.726788] [longtitude : 76.246599] [altitude: 334.510010] </font

These lines are in specific patterns Line Numbers (4,10,16,22,28,...)

I have tried this but problem is in every new files I have to put date manually.

.*2022-09-29.*[\r]?[\n]

1 Answer 1

2

You can use

^\d{4}-\d\d-\d\d\h.*\R
  • ^ Start of string
  • \d{4}-\d\d-\d\d Match the date like pattern where \d matches a digit
  • \h Match a horizontal whitespace char
  • .* Match the rest of the line
  • \R Match a newline

Regex demo

In the replacement use an empty string.

Sign up to request clarification or add additional context in comments.

2 Comments

This is a good one. One question: \R is to match a new line so \n doesn't work here? Sorry if its a dummy question, cheers.
@RavinderSingh13 Hi there, \n or as the OP has it as \r?\n will also work. Using \R matches any unicode newline sequence.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.