Thursday, August 28, 2025

Extract a portion of a log file based on the starting timestamp

If there are multiple matches, this command takes the last start and the first end, which may not be what you want. If that is acceptable, consider anchoring one line before the start and one after the end to ensure the full range is captured:
sed -n '/^2025-08-28 01:00:04,114/,/^2025-08-28 01:00:08,178/p' /tmp/test.log

No comments:

Followers