


To get data between a range of dates with certain time examples from 11 Dec 18:45:06 to 11 Dec 19:00:01, use the below command. Syntax $ sudo sed -n '/pattern1/,/pattern2/p' logfile Now we will show you How to filter data using sed command line. Syntax awk -v start=00:00 -v stop=09:00 'start /dev/null 2>&1)ĭec 11 19:51:58 LINUX dbus-daemon: Activating via systemd: service name='1' unit='' requested by ':1.320' (uid=1000 pid=38994 comm="/usr/bin/gnome-screenshot -gapplication-service " label="unconfined")ĭec 11 19:51:58 LINUX systemd: Starting Hostname Service.ĭec 11 19:51:58 LINUX dbus-daemon: Successfully activated service '1'ĭec 11 19:51:58 LINUX systemd: Started Hostname Service. Date and Time range extraction of a log fileįirst, we filter the syslogfile based on the time range using awk. In this article, we will filter /var/log/syslog file based on date range using both awkand grepcommand-line tools in the Linux System. While grepis simple pattern tool that search pattern using a regular expression. The awk is a popular command-line tool used to manipulate data in files and generate a report based on a given pattern in the Linux System. But when you want to filter data in an organized way based on time, then we use awkor grep. Simple doing catto read logfile is a kind basic way to inspect log file.

If you are facing difficulty while systematically reading log files.
