0

I have a csv file having data as below format.

09:20:02.063,110.600,110.300,110.600
09:20:08.425,111.600,110.300,110.600
09:21:02.684,111.600,110.300,110.600
09:21:03.188,110.600,110.300,110.600
09:22:05.552,110.600,110.300,110.600
09:22:03.914,113.600,110.300,110.600
09:23:04.282,112.600,110.300,110.600
09:23:05.643,111.600,110.300,110.600
09:24:01.004,111.600,110.300,110.600
09:24:05.369,110.600,110.300,110.600

What I want to do is to remove the entire rows that beginning as “09:23”, However the data format consist of Hour:Minute:Second.Millisecond. It is difficult for me to using Perl to just specific “Hour:Minute” to remove the rows. Any advice, Thanks

Expected result

09:20:02.063,110.600,110.300,110.600
09:20:08.425,111.600,110.300,110.600
09:21:02.684,111.600,110.300,110.600
09:21:03.188,110.600,110.300,110.600
09:22:05.552,110.600,110.300,110.600
09:22:03.914,113.600,110.300,110.600
09:24:01.004,111.600,110.300,110.600
09:24:05.369,110.600,110.300,110.600
1
  • Since you're new to Stack Overflow, i suggest you to read this Commented Jul 12, 2015 at 13:48

1 Answer 1

1

You may try this,

$ perl -lne 'print if !/^09:23\b/' file
09:20:02.063,110.600,110.300,110.600
09:20:08.425,111.600,110.300,110.600
09:21:02.684,111.600,110.300,110.600
09:21:03.188,110.600,110.300,110.600
09:22:05.552,110.600,110.300,110.600
09:22:03.914,113.600,110.300,110.600
09:24:01.004,111.600,110.300,110.600
09:24:05.369,110.600,110.300,110.600

Or

With grep,

grep -v '^09:23\b' file
Sign up to request clarification or add additional context in comments.

1 Comment

or perl -ne 'print if !/^09:23:/' file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.