DEV Community

Quick sed lesson

Kamal Mustafa on October 12, 2018

I was looking for a way to "grep" logs within certain time range. The first one I found (and use all the time since then) is using awk:- awk '/r...
Collapse
 
yonootz321 profile image
yonootz321

What if there's no log with that specific time?

Collapse
 
ferricoxide profile image
Thomas H Jones II

You can make the time less and less unique by eliminating the further-right time-fields. That said, once you start getting into the range where your granularity is hours, maybe you don't need to be cutting down your logs all that much, any way?

Collapse
 
k4ml profile image
Kamal Mustafa

Good question. Obviously I made assumption on the time format, as that all logs I have. What kind of format do you have?

Collapse
 
tux0r profile image
tux0r

And after you find your way through sed, nothing is stopping you from adapting ed as your daily text editor.

Collapse
 
letsfindcourse profile image
letsfindcourse

This tutorial means that this is a brief introductory guide to SED that will help give beginners a solid foundation about concrete tasks.
letsfindcourse.com/tutorials/sed-t...