View logs by date sed linux | |
---|---|
Subject: | |
Another use of sed consists in printing the lines from a file that match a given regular expression. For example, we may be interested in viewing the authorization and authentication activities that took place on July 2, as per the /var/log/secure log in aCentOS 7 server. In this case, the pattern to search for is Jul 2 at the beginning of each line: # sed -n '/^Jul 1/ p' /var/log/secure | |
2016-09-03 17:58:13 | gstlouis |